https://github.com/alpine-alpaca/asefile
Library for loading Aseprite files. Directly reads binary Aseprite files and does not require you to export files to JSON.
https://github.com/alpine-alpaca/asefile
gamedev-library pixel-art rust
Last synced: 3 months ago
JSON representation
Library for loading Aseprite files. Directly reads binary Aseprite files and does not require you to export files to JSON.
- Host: GitHub
- URL: https://github.com/alpine-alpaca/asefile
- Owner: alpine-alpaca
- License: mit
- Created: 2021-03-06T22:32:16.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-07-21T13:15:22.000Z (almost 2 years ago)
- Last Synced: 2025-11-24T02:24:05.489Z (7 months ago)
- Topics: gamedev-library, pixel-art, rust
- Language: Rust
- Homepage:
- Size: 6.41 MB
- Stars: 49
- Watchers: 1
- Forks: 17
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# asefile
[](https://github.com/alpine-alpaca/asefile/actions/)
[](https://crates.io/crates/asefile)
[](https://docs.rs/asefile)
Utilities for loading [Aseprite](https://www.aseprite.org/) files. This library
directly reads the binary Aseprite files ([specification][spec]) 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](https://docs.rs/asefile/) | [Changelog](CHANGELOG.md)
[spec]: https://github.com/aseprite/aseprite/blob/master/docs/ase-file-specs.md
# Example
```rust
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:
- color profiles
# Bug compatibility
- For indexed color files Aseprite supports blend modes, but ignores them when
exporting the image. The images constructed by `asefile` currently match the
in-editor preview.
- Aseprite has a bug in its luminance and color blend modes. Since this is the
same in editor and in exported files, `asefile` reproduces this bug. (If
Aseprite fixes this, `asefile` will fix this bug based on the version that
the file was generated with.)