A Rust command-line tool for converting Aseprite sprite files into C header files with optimized bitmap data for embedded systems and retro game development.
- Converts Aseprite
.asepritefiles to C header files with bitmap data - Generates 1-bit bitmap arrays from sprite frames
- Extracts animation frame sequences from Aseprite tags
- Optimized for embedded systems and retro displays
- Automatic frame and animation array generation
- Rust (latest stable version)
- Aseprite command-line tool (must be in PATH)
git clone https://github.com/your-username/acegen.git
cd acegen
cargo build --releaseThe binary will be available at target/release/acegen.
acegen <sprite_file.aseprite>acegen zivorad.asepriteThis will generate a zivorad.h file containing:
- Individual frame bitmap arrays (
zivorad_0_map[],zivorad_1_map[], etc.) - Frame pointer array (
zivorad_frames[]) - Animation sequences based on Aseprite tags (
Idle_anim[],Walk_anim[], etc.)
The generated C header file contains:
Each sprite frame is converted to a 1-bit bitmap array:
uint8_t zivorad_0_map[] = {
0x00, 0x3f, 0xf0, 0x00,
0x00, 0xc0, 0x08, 0x00,
// ... more bitmap data
};A pointer array for easy frame access:
uint8_t* zivorad_frames[] = {
zivorad_0_map,
zivorad_1_map,
// ... more frames
};Animation arrays based on Aseprite tags:
uint8_t Idle_anim[] = { 0, 1, 2, 3 };
uint8_t Walk_anim[] = { 4, 5 };- Sprite Processing: Uses Aseprite CLI to export sprite sheets as PNG + JSON
- Bitmap Conversion: Reads PNG data and converts alpha channel to 1-bit bitmap
- Data Packing: Packs 8 pixels per byte for memory efficiency
- Animation Extraction: Reads Aseprite frame tags to generate animation sequences
- C Header Generation: Outputs properly formatted C arrays
src/main.rs- CLI entry point and argument handlingsrc/lib.rs- Core sprite processing functionalitytests/- Integration testsCargo.toml- Project dependencies and metadata
aseprite- For parsing Aseprite JSON export datapng- For reading PNG bitmap dataserde_json- For JSON parsing
Run the test suite:
cargo test- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Embedded Systems: Generate compact bitmap data for microcontroller displays
- Retro Game Development: Create sprite data for 8-bit style games
- Arduino Projects: Display animated sprites on OLED/LCD screens
- Custom Display Drivers: Integrate sprite data into custom graphics systems