Expand description
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::Image;
pub use self::kernel::Kernel;
Modules
Macros
Iterate over pixels using Image::get_pixel
Iterate over pixels using Image::at_mut