Crates.io | farbe |
lib.rs | farbe |
version | 0.2.0 |
source | src |
created_at | 2023-03-26 01:03:52.777456 |
updated_at | 2023-04-19 13:27:44.846822 |
description | A library for working with retro image formats |
homepage | https://crates.io/crates/farbe |
repository | https://github.com/retrofoundry/farbe |
max_upload_size | |
id | 820718 |
size | 44,316 |
Library for working with retro image formats
This library currently supports the following:
Add this to your Cargo.toml:
[dependencies]
farbe = "0.1.0"
# 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
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();