Trait img_hash::Image [−][src]
pub trait Image: GenericImageView + 'static { type Buf: Image + DiffImage; 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]); }
Shorthand trait bound for APIs in this crate.
Currently only implemented for the types provided by image
with 8-bit channels.
Associated Types
Loading content...Required methods
fn to_grayscale(&self) -> Cow<'_, GrayImage>
[src]
Grayscale the image, reducing to 8 bit depth and dropping the alpha channel.
fn blur(&self, sigma: f32) -> Self::Buf
[src]
Blur the image with the given Gaussian
sigma.
fn foreach_pixel8<F>(&self, foreach: F) where
F: FnMut(u32, u32, &[u8]),
[src]
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.
Implementations on Foreign Types
impl<P: 'static, C: 'static> Image for ImageBuffer<P, C> where
P: Pixel<Subpixel = u8>,
C: Deref<Target = [u8]>,
[src]
impl<P: 'static, C: 'static> Image for ImageBuffer<P, C> where
P: Pixel<Subpixel = u8>,
C: Deref<Target = [u8]>,
[src]impl Image for DynamicImage
[src]
impl Image for DynamicImage
[src]