Trait image_hasher::Image
source · pub trait Image: GenericImageView + 'static {
type Buf: Image + DiffImage;
// Required methods
fn to_grayscale(&self) -> Cow<'_, GrayImage>;
fn blur(&self, sigma: f32) -> Self::Buf;
fn foreach_pixel8<F>(&self, foreach: F)
where F: FnMut(u32, u32, &[u8]);
}
Expand description
Shorthand trait bound for APIs in this crate.
Currently only implemented for the types provided by image
with 8-bit channels.
Required Associated Types§
Required Methods§
sourcefn to_grayscale(&self) -> Cow<'_, GrayImage>
fn to_grayscale(&self) -> Cow<'_, GrayImage>
Grayscale the image, reducing to 8 bit depth and dropping the alpha channel.
sourcefn foreach_pixel8<F>(&self, foreach: F)where
F: FnMut(u32, u32, &[u8]),
fn foreach_pixel8<F>(&self, foreach: F)where F: FnMut(u32, u32, &[u8]),
Iterate over the image, passing each pixel’s coordinates and values in u8
to the closure.
The iteration order is unspecified but each pixel must be visited exactly once.
If the pixel’s channels are wider than 8 bits then the values should be scaled to
[0, 255]
, not truncated.
Note
If the pixel data length is 2 or 4, the last index is assumed to be the alpha channel.
A pixel data length outside of [1, 4]
will cause a panic.