#2d-game #2d #graphics #load-image #sprite-sheet #game

aseprite

A crate to load files from the aseprite sprite editor

4 releases

Uses old Rust 2015

0.1.3 Jun 3, 2017
0.1.2 Apr 27, 2017
0.1.1 Apr 25, 2017
0.1.0 Apr 25, 2017

#124 in Data formats

Download history 23/week @ 2023-12-11 23/week @ 2023-12-18 37/week @ 2023-12-25 11/week @ 2024-01-01 24/week @ 2024-01-08 17/week @ 2024-01-15 8/week @ 2024-01-22 10/week @ 2024-01-29 10/week @ 2024-02-05 26/week @ 2024-02-12 47/week @ 2024-02-19 31/week @ 2024-02-26 54/week @ 2024-03-04 58/week @ 2024-03-11 34/week @ 2024-03-18 61/week @ 2024-03-25

211 downloads per month
Used in 7 crates (via castle-game)

MIT license

8KB
185 lines

aseprite

A crate for loading data from the aseprite sprite editor. Should go along well with the tiled crate, I hope!

It does not load any actual images, just the metadata. Currently it only loads aseprite's JSON export format, and only when exported in the "json-array" format (which isn't the default for some reason but appears much more sensible than the alternative).

Automatically exporting a sprite to a given format is documented here: https://www.aseprite.org/docs/cli/

Docs

Documentation is on docs.rs

Example

Export sprite sheet with:

aseprite -b boonga.ase --sheet boonga.png --format json-array --list-tags --list-layers --data boonga.json

Then write a program to load it:

extern crate serde_json;
extern crate aseprite;

use std::fs::File;

fn main() {
   let file = File::open("boonga.json").unwrap();
   let spritesheet: aseprite::SpritesheetData = serde_json::from_reader(file).unwrap();
   println!("Spritesheet is {:?}", spritesheet);
}

Dependencies

~0.7–1.4MB
~32K SLoC