Crate img_qoi

Crate img_qoi 

Source
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§

QoiDecodedChunks
Iterator which yields QoiResult<QoiDecodedChunk>. See qoi_decode.
QoiDesc
QOI image description.
QoiPixel
RGBA8 pixel.

Enums§

QoiChannels
QOI channels (RGBA8 or RGB8).
QoiDecodedChunk
Decoded QOI chunk.
QoiError
Errors on img-qoi crate.

Functions§

qoi_decode
Decodes QOI body (without header) from Read, and returns an iterator of QoiResult<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 new Vec.
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 IntoIterator to QOI body (without header), and writes it to Write.
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 of QoiResult<QoiDecodedChunk>.
qoi_read_header
Reads QOI header from Read, and returns QoiDesc.
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 from IntoIterator.
qoi_write_header
Writes QOI header to Write.

Type Aliases§

QoiResult
Specialized Result for img-qoi crate.