Expand description
QOI (Quite OK Image) manipulation library.
§Examples
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)?;Structs§
- QoiDecoded
Chunks - Iterator which yields
QoiResult<QoiDecodedChunk>. Seeqoi_decode. - QoiDesc
- QOI image description.
- QoiPixel
- RGBA8 pixel.
Enums§
- QoiChannels
- QOI channels (RGBA8 or RGB8).
- QoiDecoded
Chunk - Decoded QOI chunk.
- QoiError
- Errors on
img-qoicrate.
Functions§
- qoi_
decode - Decodes QOI body (without header) from
Read, and returns an iterator ofQoiResult<QoiDecodedChunk>. - qoi_
decode_ to_ buffer - Decodes QOI body (without header) from
Read, and writes pixels to an existing buffer. - qoi_
decode_ to_ vec - Decodes QOI body (without header) from
Read, and writes pixels to a newVec. - qoi_
encode_ from_ buffer - Encodes pixels on memory to QOI body (without header), and writes it to
Write. - qoi_
encode_ from_ iter - Encodes pixels from
IntoIteratorto QOI body (without header), and writes it toWrite. - qoi_
open - Loads QOI format (with header) from file. Returns a image description and a newly allocated pixel buffer.
- qoi_
read - Reads QOI format (with header) from
Read, and returns a image description and an iterator ofQoiResult<QoiDecodedChunk>. - qoi_
read_ header - Reads QOI header from
Read, and returnsQoiDesc. - qoi_
read_ to_ vec - Reads QOI format (with header) from
Read. Returns a image description and a newly allocated pixel buffer. - qoi_
save_ from_ buffer - Saves QOI format (with header) to file. Pixels are obtained from a pixel buffer.
- qoi_
save_ from_ iter - Saves QOI format (with header) to file. Pixels are obtained from
IntoIterator. - qoi_
write_ from_ buffer - Writes QOI format (with header) to
Write. Pixels are obtained from a pixel buffer. - qoi_
write_ from_ iter - Writes QOI format (with header) to
Write. Pixels are obtained fromIntoIterator. - qoi_
write_ header - Writes QOI header to
Write.