Crate image_buffer [] [src]

Image buffer abstractions

Image buffer

image_buffer provides an ImageBuffer which helps to access the pixels of an image. It provides iterators over the pixels of the image (via ImageBuffer::pixels[_mut] and ImageBuffer::enumerate_pixels[_mut]). Furthermore it implements Index and IndexMut which takes a tuple (x, y) with the coordinates of the pixel. (0, 0) is in the top left corner.

An image buffer can either be create by wrapping an existing buffer

let mut data = vec![0; 100 * 100];
let buffer: GrayImage = ImageBuffer::from_raw(100, 100, data).unwrap();
data = buffer.into_raw();

or by constructing a new one baked by a std::Vec

let _: RgbImage = ImageBuffer::new(100, 100);

.

Color types

This crate implements various color types, accessible via the color module. They implement From wherever it makes sense to be able to convert between them. The Rgb to Gray conversion assumes Rgb to be in the sRGB color model.

The ImageBuffer uses this to provide a convenience method for color conversions

let _: GrayImage = RgbImage::new(100, 100).convert_buffer();

Modules

color

Structs

EnumeratePixels

Enumerate the pixels of an image.

EnumeratePixelsMut

Enumerate the mutable pixels of an image.

ImageBuffer

Generic image buffer.

Pixels

Iterator over references to pixels.

PixelsMut

Iterator over mutable references to pixels.

Traits

Color

A generalized pixel.

ImageView

A view into an image

Primitive

Primitive trait from old stdlib.

Type Definitions

GrayAlphaImage

Sendable grayscale + alpha channel image buffer

GrayImage

Sendable grayscale image buffer

RgbImage

Sendable Rgb image buffer

RgbaImage

Sendable Rgb + alpha channel image buffer