Expand description
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§
Structs§
- Enumerate
Pixels - Enumerate the pixels of an image.
- Enumerate
Pixels Mut - Enumerate the mutable pixels of an image.
- Image
Buffer - Generic image buffer.
- Pixels
- Iterator over references to pixels.
- Pixels
Mut - Iterator over mutable references to pixels.
Traits§
Type Aliases§
- Gray
Alpha Image - Sendable grayscale + alpha channel image buffer
- Gray
Image - Sendable grayscale image buffer
- RgbImage
- Sendable Rgb image buffer
- Rgba
Image - Sendable Rgb + alpha channel image buffer