Crate image2

source ·
Expand description

image2 - a high-performance image processing library with wide support for a variety of file formats and data types

OpenImageIO is used for encoding and decoding images, it should be installed before building image2.

use image2::*;

fn main() -> Result<(), Error> {
    // Load an image from disk
    let image = Image::<f32, Rgb>::open("images/A.exr")?;

    // Apply a `Filter`, in this case using the `Convert` filter to
    // convert from `Rgb` to `Gray`
    let conv = filter::convert::<f32, Rgb, f32, Gray>();
    let mut dest = image.new_like_with_color::<Gray>();
    dest.apply(conv, &[&image]);

    // This is equivalent to:
    let conv = filter::convert();
    let dest: Image<f32, Gray> = image.run(conv, None);

    // Save an image to disk
    dest.save("test.jpg")?;

    Ok(())
}

Re-exports

pub use kernel::Kernel;
pub use transform::Transform;

Modules

Image processing filters
Image input/output
Convolutions kernels
Text
OpenGL interop
Image transforms
Display images

Structs

A Filter that can be executed using async
async-friendly Pipeline
Four-channel, cyan, magenta, yellow and black
Wraps image data slices, tagging them with a Color type
Wraps mutable image data slices, tagging them with a Color type
Single-channel grayscale
Hash is used for content-based hashing
Image histogram
Three-channel hue, saturation and value color
Image type
Filter input
Image metadata
Memory-mapped image data
Pipelines are used to compose several filters
Normalized image data
Three-channel red, green, blue
Four-channel red, green, blue with alpha channel
Log space, three-channel red, green, blue
Log space, four-channel red, green, blue with alpha channel
Three-channel CIE-XYZ
Three-channel, luma, blue projection and red projection
16-bit float A 16-bit floating point type implementing the IEEE 754-2008 standard binary16 a.k.a half format.

Enums

AsyncMode is used to schedule the type of iteration for an AsyncFilter
Enumerates possible errors
Used to determine if a filter can be executed and interleaved at the pixel level or if the whole filter needs to be evaulated before moving to the next filter

Traits

Color trait is used to define color spaces
Filters are used to manipulate images in a generic, composable manner
Filter extension methods
ImageData is used to hold pixel data for images
Parallel version of the standard iterator trait.
Type is used to represent supported image data types

Type Definitions

Channel is an alias for usize used to identify channel values in function arguments
(x, y) coordinates
Region of interest
Image (width, height)