[][src]Crate image2

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

Getting started:

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

fn main() {
   // Read an image using the default JPEG decoder (stb_image)
   let image: ImageBuf<f64, Rgb> = io::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 the default PNG encoder (stb_image)
   io::write("example.png", &output).unwrap();
}

Re-exports

pub use self::color::Color;
pub use self::color::Gray;
pub use self::color::Rgb;
pub use self::color::Rgba;
pub use self::filter::Filter;
pub use self::image::Convert;
pub use self::image::Diff;
pub use self::image::Hash;
pub use self::image::Image;
pub use self::kernel::Kernel;

Modules

color
colorspace
filter
image
io
kernel
transform

Macros

filter

filter is used to simplify the process of defining compute_at to create new filters

Structs

ImageBuf

Image implementation using Vec<T> to store data

ImagePtr

Image implementation backed by a raw pointer, typically used for storing C pointers allocated using malloc.

ImageRef

Image implementation backed by a mutable array reference

PixelVec

PixelVec is a 4-channel pixel backed by a static array

Enums

Error
Free

Determines how to free a pointer stored in an ImagePtr

Traits

Pixel

Pixel is used to access chunks of image data

PixelMut

PixelMut is used to access mutable chunks of image data

Type

Implementing Type allows for a type to be used as values contained in an Image