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

The image type when converted to grayscale.

Required Methods

The dimensions of the image as (width, height).

Returns a copy, leaving self unmodified.

Convert self to grayscale.

Important traits for Vec<u8>

Convert self to a byte-vector.

Get the number of pixel channels in the image:

  • 1 -> Grayscale
  • 2 -> Grayscale with Alpha
  • 3 -> RGB
  • 4 -> RGB with Alpha

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]

Important traits for Vec<u8>

impl HashImage for GrayAlphaImage
[src]

Important traits for Vec<u8>

impl HashImage for RgbImage
[src]

Important traits for Vec<u8>

impl HashImage for RgbaImage
[src]

Important traits for Vec<u8>

impl HashImage for DynamicImage
[src]

Important traits for Vec<u8>

Implementors