Crate image2[][src]

image2 is an image processing crate with a focus on ease-of-use, support for a wide range of datatypes and composable operations.

As you may notice, image2 optionally depends on ImageMagick/GraphicsMagick for loading images. io::magick defines methods for loading and saving images of many data/color types.

Getting started:

use image2::{
   ImageBuf,
   Rgb, Gray,
   Type,
   io::magick,
   Filter,
   filter::ToGrayscale
};

fn main() {
   // Read an image using ImageMagick, `io::magick` is provided by default
   let image: ImageBuf<f64, Rgb> = magick::read("test/test.jpg").unwrap();

   // Setup a filter
   let filter = ToGrayscale.and_then(|f| {
       f64::max_f() - f
   });

   // Create an output image
   let mut output: ImageBuf<f64, Gray> = ImageBuf::new_like_with_color::<Gray>(&image);

   // Execute the filter
   filter.eval(&mut output, &[&image]);

   // Save the image using ImageMagick
   magick::write("inverted_grayscale.jpg", &output).unwrap();
}

Re-exports

pub use color::Color;
pub use color::Gray;
pub use color::Rgb;
pub use color::Rgba;
pub use filter::Filter;
pub use image::Image;
pub use image::Layout;
pub use kernel::Kernel;

Modules

color
filter
image
io
kernel
transform

Macros

image2_filter
image2_for_each

Iterate over pixels using Image::get_pixel

image2_for_each_mut

Iterate over pixels using Image::at_mut

Structs

ImageBuf

Image implementation that uses a Vec for image data

ImageRef
PixelVec

Enums

Error

Traits

Pixel
PixelMut
Type