Crates.io | img-qoi |
lib.rs | img-qoi |
version | 0.1.0 |
source | src |
created_at | 2021-11-30 03:09:22.418732 |
updated_at | 2021-11-30 03:09:22.418732 |
description | QOI (Quite OK Image) manipulation library |
homepage | https://github.com/taotao54321/img-qoi |
repository | https://github.com/taotao54321/img-qoi |
max_upload_size | |
id | 489593 |
size | 81,672 |
Convert QOI to PNG (with image
crate):
use image::RgbaImage;
use img_qoi::*;
let (desc, buf_rgba) = qoi_open("foo.qoi", QoiChannels::Rgba)?;
let img = RgbaImage::from_vec(desc.width().get(), desc.height().get(), buf_rgba).unwrap();
img.save("foo.png")?;
Convert PNG to QOI (with image
crate):
use std::num::NonZeroU32;
use img_qoi::*;
let img = image::open("foo.png")?;
let img = img.to_rgba8();
let desc = QoiDesc::new(
NonZeroU32::new(img.width()).unwrap(),
NonZeroU32::new(img.height()).unwrap()
);
// `RgbaImage` implements `Deref<[u8]>`.
qoi_save_from_buffer("foo.qoi", &desc, &*img, QoiChannels::Rgba)?;
MIT