alpine-alpaca / asefile

Library for loading Aseprite files. Directly reads binary Aseprite files and does not require you to export files to JSON.
MIT License
43 stars 15 forks source link
gamedev-library pixel-art rust

asefile

Build status crates.io Documentation

Utilities for loading Aseprite files. This library directly reads the binary Aseprite files (specification) and does not require you to export files to JSON. This should make it fast enough to load your assets when the game boots up (during development). You can also use it to build your own asset pipelines.

Documentation | Changelog

Example

use std::path::Path;

use asefile::AsepriteFile;
use image::{self, ImageFormat};

fn main() {
    let file = Path::new("input.aseprite");
    // Read file into memory
    let ase = AsepriteFile::read_file(&file).unwrap();
    // Write one output image for each frame in the Aseprite file.
    for frame in 0..ase.num_frames() {
        let output = format!("output_{}.png", frame);
        // Create image in memory, then write it to disk as PNG.
        let img = ase.frame(frame).image();
        img.save_with_format(output, ImageFormat::Png).unwrap();
    }
}

Unsupported Features

The following features of Aseprite 1.2.25 are currently not supported:

Bug compatibility