Crates.io | cluttered |
lib.rs | cluttered |
version | 0.11.0 |
source | src |
created_at | 2023-01-19 03:11:32.47689 |
updated_at | 2024-07-15 16:36:26.335742 |
description | A CLI Texture Packer written in rust |
homepage | |
repository | https://github.com/Terria-K/cluttered |
max_upload_size | |
id | 762228 |
size | 170,398 |
A CLI Texture Packer written in rust that can pack a bunch of images optimally based on crunch-rs. Supports many formats as well including json, binary and ron.
It can be used for games with Godot, Monogame or a bunch more that needed to optimize the memory usage.
This CLI Texture Packer is based around the config file, which you would have to create in order to pack the images. Example content of the config file with toml format:
name = "gem_collections"
output_path = "samples/out"
output_type = "Json"
template_path = "samples/xml-template.xml"
folders = [
"samples/images/common",
"samples/images/rare",
"samples/images/legendary",
"samples/images/rect"
]
[image_options]
output_extension = "Png"
max_size = 4096
show_extension = false
[features]
nine_patch = true
Then, in the CLI usage:
cluttered config --input <INPUT>
Example:
cluttered config --input packer-config.toml
Alternatively, we can use the manual way, which we can use the argument called pack
cluttered pack --input <[INPUT]> --output <OUTPUT>
Example:
cluttered pack --input images/legendary images/rare --output out --type json
name | description |
---|---|
--type | Specify the output type. |
--name | Specify the name of the output. |
--templatepath | Specify the template path for the custom template output. |
[String] - Name
[UInt32] - Count (Use it in for loops below)
L [String] - Name
[UInt32] - X
[UInt32] - Y
[UInt32] - Width
[UInt32] - Height
[Bool] - HasNinePatch (if nine_patch is enabled)
[UInt32] - X (if nine_patch is enabled and has a file)
[UInt32] - Y (if nine_patch is enabled and has a file)
[UInt32] - W (if nine_patch is enabled and has a file)
[UInt32] - H (if nine_patch is enabled and has a file)
We also support custom template with handlebars write your own custom template to support your favourite format or make a new one.
Example usage on xml format:
<TextureAtlas imagePath="{{atlas.sheet_path}}">
{{#each atlas.frames as frame}}
<Texture
name="{{@key}}"
x="{{this.x}}" y="{{this.y}}"
width="{{this.width}}" height="{{this.height}}"
{{#if this.nine_patch}}
nx="{{this.nine_patch.x}}" ny="{{this.nine_patch.y}}"
nw="{{this.nine_patch.w}}" nh="{{this.nine_patch.h}}"
{{/if}}
/>
{{/each}}
</TextureAtlas>
Name | Type |
---|---|
config | Config |
atlas | PackerAtlas |
Name | Type |
---|---|
name | String |
output_path | String |
output_type | OutputType |
folders | String[] |
allow_normal_output | bool |
template_path | String or String[]? |
options | ImageOptions |
features | Features |
Name |
---|
Json |
Binary |
Ron |
Template |
Name | Type |
---|---|
max_size | int |
output_extension | OutputExtensionType |
show_extension | bool |
Name |
---|
Png |
Qoi |
Jpg |
Name | Type |
---|---|
nine_patch | bool |
aseprite | bool |
ase_sheet | bool |
Name | Type |
---|---|
sheet_path | String |
frames | HashMap<String, TextureData> |
Name | Type |
---|---|
x | int |
y | int |
width | int |
height | int |
nine_patch | Rect? |
Name | Type |
---|---|
x | int |
y | int |
w | int |
h | int |