atlaspack
Tiny deterministic sprite atlas packer for game dev.
Point it at a folder of PNGs. Get one atlas image and a JSON sheet. No engine dependency, no editor, no account — a finished CLI you can install and forget about.
# writes atlas.png + atlas.json
Install
# From crates.io (after publish)
# From this repository
# From a local checkout
Requires a Rust toolchain (MSRV 1.88).
Usage
atlaspack <INPUT> [OPTIONS]
Arguments:
<INPUT> Directory of .png sprites (recursive)
Options:
-o, --output <OUTPUT> Atlas PNG path [default: atlas.png]
-j, --json <JSON> JSON path [default: <output>.json]
-p, --padding <PADDING> Gap between sprites in px [default: 2]
--max-size <MAX_SIZE> Max atlas edge [default: 4096]
--no-pot Allow non power-of-two sizes
-h, --help
-V, --version
Example
JSON shape
- name — path relative to the input dir, without
.png(stable, sorted). - x, y, w, h — pixel rect in the atlas (top-left origin).
Drop the JSON into Bevy, macroquad, ggez, Godot, or your own loader. This tool does not care.
Guarantees
| Promise | Detail |
|---|---|
| Deterministic | Same files + flags → same pixels and JSON |
| Finished | v1.0 scope is locked; no roadmap treadmill |
| Engine-agnostic | Only depends on PNG + JSON |
| Low maintenance | Shelf packer, not a research project |
Library
use ;
let packed = pack_directory?;
// packed.image : RgbaImage
// packed.json : AtlasJson
# Ok::
API docs: https://docs.rs/atlaspack
Non-goals
- GUI / live preview
- Bevy (or any engine) plugin
- Texture compression (KTX2/Basis)
- Rotated packing, multipack, trimming
Those are fine projects for someone else. This crate stays small.
Status
Maintenance: best-effort. Scope is intentionally locked at v1. Bug fixes welcome; large feature expansions are out of scope (fork freely).
Contributing
Issues and small PRs are welcome. Please run cargo fmt, cargo clippy -- -D warnings, and cargo test before opening a PR.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.