farbe

Crates.iofarbe
lib.rsfarbe
version0.2.0
sourcesrc
created_at2023-03-26 01:03:52.777456
updated_at2023-04-19 13:27:44.846822
descriptionA library for working with retro image formats
homepagehttps://crates.io/crates/farbe
repositoryhttps://github.com/retrofoundry/farbe
max_upload_size
id820718
size44,316
David Chavez (dcvz)

documentation

README

farbe

Library for working with retro image formats

This library currently supports the following:

  • converting to and from n64 formats

Installation

Add this to your Cargo.toml:

[dependencies]
farbe = "0.1.0"

How to use

As a cli

# convert to png (width and height are required in this case)
farbe test.rgba32 -o output.png -f rgba32 --width 24 --height 24

# convert to n64 format
farbe test.png -o output.rgba32 -f rgba32

As a library

use farbe::image::n64::{ImageFormat, NativeImage, PNGImage};

// convert to png
let bytes: &[u8] = include_bytes!("image.rgba32")
let image = NativeImage::read(bytes, ImageFormat::RGBA32, 160, 160).unwrap();

let mut output_file = std::fs::File::create("image.png").unwrap();
image.as_png(&mut output_file).unwrap();

// convert to n64 format
let bytes: &[u8] = include_bytes!("image.png");
let image = PNGImage::read(bytes).unwrap();

let mut output_file = std::fs::File::create("image.output.rgba32").unwrap();
image.as_rgba32(&mut output_file).unwrap();
Commit count: 8

cargo fmt