Building a sprite atlas cli in Odin
Let's build a small sprite atlas CLI in Odin and use it to compare six
rectangle-packing algorithms on the same folder of PNGs. Given loose sprites
and a width limit, the tool packs them into one RGBA8 texture and writes each
sprite's name and rectangle as JSON or a Godot 4 SpriteFrames resource.
Odin fits this kind of data-oriented tool well: the packers operate on
plain slices of sizes and rectangles, and we only touch pixel buffers once
every sprite has coordinates. Odin's core library covers the rest without
third-party packages: core:flags
parses command-line flags, core:image/png
decodes and encodes PNGs, and core:encoding/json
serializes the layout struct.
Install Odin (installation instructions)
and check your setup with odin version. Every example below targets
dev-2026-11a.
Read more
Read more: Building a sprite atlas cli in Odin