Trait img_hash::HashImage [−][src]
pub trait HashImage { type Grayscale: HashImage; fn dimensions(&self) -> (u32, u32); fn resize(&self, width: u32, height: u32) -> Self; fn grayscale(&self) -> Self::Grayscale; fn to_bytes(self) -> Vec<u8>; fn channel_count() -> u8; fn foreach_pixel<F>(&self, iter_fn: F)
where
F: FnMut(u32, u32, &[u8]); }
A trait for describing an image that can be successfully hashed.
Implement this for custom image types.
Associated Types
Required Methods
fn dimensions(&self) -> (u32, u32)
The dimensions of the image as (width, height).
fn resize(&self, width: u32, height: u32) -> Self
Returns a copy, leaving self
unmodified.
fn grayscale(&self) -> Self::Grayscale
Convert self
to grayscale.
fn to_bytes(self) -> Vec<u8>
Convert self
to a byte-vector.
fn channel_count() -> u8
Get the number of pixel channels in the image:
- 1 -> Grayscale
- 2 -> Grayscale with Alpha
- 3 -> RGB
- 4 -> RGB with Alpha
fn foreach_pixel<F>(&self, iter_fn: F) where
F: FnMut(u32, u32, &[u8]),
F: FnMut(u32, u32, &[u8]),
Call iter_fn
for each pixel in the image, passing (x, y, [pixel data])
.
The iteration order is unspecified. Implementations should use whatever is optimum.
Implementations on Foreign Types
impl HashImage for GrayImage
[src]
impl HashImage for GrayImage
impl HashImage for GrayAlphaImage
[src]
impl HashImage for GrayAlphaImage
impl HashImage for RgbImage
[src]
impl HashImage for RgbImage
impl HashImage for RgbaImage
[src]
impl HashImage for RgbaImage
impl HashImage for DynamicImage
[src]
impl HashImage for DynamicImage