#texture-packer #algorithm #png #image #texture-pack

bin+lib open_texture_packer

Open source and free Texture Packer tool written in rust

7 releases

new 0.2.5 Apr 11, 2025
0.2.3 Sep 30, 2024
0.1.7 Sep 26, 2024

#261 in Images

Download history 4/week @ 2025-01-19 6/week @ 2025-01-26 34/week @ 2025-02-02 3/week @ 2025-02-09 7/week @ 2025-03-09 5/week @ 2025-03-16 18/week @ 2025-03-23 8/week @ 2025-03-30 100/week @ 2025-04-06

133 downloads per month

MIT license

300KB
332 lines

Open Texture Packer

Open source and free Texture Packer tool written in rust.

twitter_header_photo_1

Installation

Home Brew

brew tap webcyou-org/tap
brew install open-texture-packer

Cargo

cargo install open_texture_packer

The otp command is available upon installation.

otp <any option>

Rust

cargo add open_texture_packer
[dependencies]
open_texture_packer = "0.2.1"

Basic Usage

Specifies the path of the directory containing the images to be textured.

otp <input_directory>

You can also specify an arbitrary directory for the output destination

otp <input_directory> [output_directory]

If nothing is specified, images in the current directory are retrieved.

otp

In the development environment, it can also be run with cargo run.

cargo run <input_directory>
cargo run <input_directory> [output_directory]
cargo run

Result - Basic Usage

When performed when three sprites (sprite1.png, sprite2.png, sprite3.png) of different sizes are present in a directory

The following files are generated in the output

texture_sheet_1.css
texture_sheet_1.json
texture_sheet_1.png

The texture_sheet_1.png is merged to produce a texture image as follows

Packing Algorithm

Currently, the process is similar to Shelf Packing and Next Fit.

We plan to add them in the near future and make them selectable.

  • Shelf Packing
  • Next Fit
  • Best Fit
  • First Fit
  • Worst Fit
  • First Fit Decreasing
  • Best Fit Decreasing
  • Guillotine Cutting
  • Skyline Algorithm
  • Maximal Rectangles

Author

Daisuke Takayama

License

Copyright (c) 2024 Daisuke Takayama Released under the MIT license

Dependencies

~5.5MB
~103K SLoC