snes-gfx

Crates.iosnes-gfx
lib.rssnes-gfx
version0.1.5
sourcesrc
created_at2024-09-23 15:09:38.559053
updated_at2024-09-27 13:55:54.831737
descriptionA library for processing SNES-graphics data and nametables.
homepage
repositoryhttps://github.com/NibbleOfAnOctet/shadowresources/tree/main/libs/snes-gfx
max_upload_size
id1384211
size11,384
Simon Lindell (NibbleOfAnOctet)

documentation

README

SNES-GFX

A tool for converting tiles and tilemaps from SNES games into images.

The tool uses data in the original LittleEndian SNES formats. The tool can convert 2BPP, 4BPP and 8BPP tiles as well as and tilemaps into RGB images. The crate is under construction and stuff will definitely break between versions.

The library is coded as a learning experience, and will probably not follow best-practices.

Usage example


use snes_gfx::{
    palette::{Format, Palette},
    tilemap::Tilemap,
    tileset::{Tileset, TilesetIterators, TilesetTrait},
};

[...]

// Load necessary data from little endian byte data.
let palette = Palette::new(&palette_data);
let tileset = Tileset::new(&tileset_data, format);
let tilemap = Tilemap::new(&tilemap_data);
        
// Generate tilemap
tilemap
    .generate_image(32, &tileset, &palette)
    .save("tilemap.png")
    .expect("Could not save tilemap image!");
// Create an iterator over tileset images
let images = tileset.image_iter(1, &palette);

// Merge into tileset 16 tiles wide
Tileset::merge_tiles(&images.collect(), 16)
    .save("tileset.png")
    .expect("Could not save tileset image!");
Commit count: 0

cargo fmt