| Crates.io | spritesheet_detector |
| lib.rs | spritesheet_detector |
| version | 0.2.1 |
| created_at | 2025-03-12 22:11:36.986155+00 |
| updated_at | 2025-07-01 05:45:33.018275+00 |
| description | A library to analyze spritesheets and detect sprite dimensions and frame count. |
| homepage | |
| repository | https://github.com/mirsella/spritesheet_detector |
| max_upload_size | |
| id | 1590277 |
| size | 206,586 |
spritesheet_detector is a Rust library that analyzes a spritesheet image and detects its grid layout and non-empty frame count. It can handle spritesheets with margin/padding (based on the color at the top-left pixel) and works even if the last row of frames is incomplete.
it was made for this type of spritesheet:

use image::open;
use spritesheet_detector::{analyze_spritesheet, SpritesheetInfo};
fn main() {
// Open your spritesheet image.
let img = open("path/to/spritesheet.png").expect("Failed to open image");
// Analyze the spritesheet.
let info: SpritesheetInfo = analyze_spritesheet(&img);
// Print the detected information.
println!(
"Sprite frame: {}x{} with {} columns and {} rows, {} valid frames.",
info.sprite_width, info.sprite_height, info.columns, info.rows, info.frame_count
);
}