Crate img_qoi[][src]

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

QOI image description.

RGBA8 pixel.

Enums

QOI channels (RGBA8 or RGB8).

Decoded QOI chunk.

Errors on img-qoi crate.

Functions

Decodes QOI body (without header) from Read, and returns an iterator of QoiResult<QoiDecodedChunk>.

Decodes QOI body (without header) from Read, and writes pixels to an existing buffer.

Decodes QOI body (without header) from Read, and writes pixels to a new Vec.

Encodes pixels on memory to QOI body (without header), and writes it to Write.

Encodes pixels from IntoIterator to QOI body (without header), and writes it to Write.

Loads QOI format (with header) from file. Returns a image description and a newly allocated pixel buffer.

Reads QOI format (with header) from Read, and returns a image description and an iterator of QoiResult<QoiDecodedChunk>.

Reads QOI header from Read, and returns QoiDesc.

Reads QOI format (with header) from Read. Returns a image description and a newly allocated pixel buffer.

Saves QOI format (with header) to file. Pixels are obtained from a pixel buffer.

Saves QOI format (with header) to file. Pixels are obtained from IntoIterator.

Writes QOI format (with header) to Write. Pixels are obtained from a pixel buffer.

Writes QOI format (with header) to Write. Pixels are obtained from IntoIterator.

Writes QOI header to Write.

Type Definitions

Specialized Result for img-qoi crate.