imago v0.1.1 Imago View Source

Link to this section Summary

Functions

Re-saves an image as a jpeg. iex> Imago.test_image() |> Imago.flatten_as_jpg

Alias for get_fingerprint_4x4

Returns an image's fingerprint, sampled on a 4x4 luminance grid

Returns an image's fingerprint, sampled on a 8x8 luminance grid.

Returns the average luminance of an image, sampled on a 4x4 grid, as an int. See get_fingerprint_4x4 for details

Alias of read_pixels_rgba

Gets a list of alpha values

Gets a list of blue values

Gets a list of green values

Gets a list of red values

Gets a list of rgb values

Gets a list of rgba values

Since we use a 8x8 image, doctests would be polluted with lists of 4 * 64 integers. This ensures validity and conciseness. The real methods do return a list of integers.

Link to this section Functions

Re-saves an image as a jpeg. iex> Imago.test_image() |> Imago.flatten_as_jpg

Alias for get_fingerprint_4x4

Link to this function

get_fingerprint_4x4(path) View Source

Returns an image's fingerprint, sampled on a 4x4 luminance grid

iex> Imago.test_image() |> Imago.get_fingerprint_4x4 |> Imago.slice5
{:ok, [207, 223, 174, 208, 225, 170]}
Link to this function

get_fingerprint_8x8(path) View Source

Returns an image's fingerprint, sampled on a 8x8 luminance grid.

iex> Imago.test_image() |> Imago.get_fingerprint_8x8 |> Imago.slice5
{:ok, [198, 222, 222, 227, 209, 161]}

Returns the average luminance of an image, sampled on a 4x4 grid, as an int. See get_fingerprint_4x4 for details

iex> Imago.test_image() |> Imago.luminance
{:ok, 192}

Alias of read_pixels_rgba

Gets a list of alpha values

iex> Imago.test_image() |> Imago.read_pixels_alpha |> Imago.slice5
{:ok, [255, 255, 255, 255, 255, 255]}

Gets a list of blue values

iex> Imago.test_image() |> Imago.read_pixels_blue |> Imago.slice5
{:ok, [198, 198, 198, 198, 198, 198]}

Gets a list of green values

iex> Imago.test_image() |> Imago.read_pixels_green |> Imago.slice5
{:ok, [198, 198, 198, 198, 198, 198]}

Gets a list of red values

iex> Imago.test_image() |> Imago.read_pixels_red |> Imago.slice5
{:ok, [198, 198, 198, 198, 198, 198]}

Gets a list of rgb values

iex> Imago.test_image() |> Imago.read_pixels_rgb |> Imago.slice5
{:ok, [198, 198, 198, 198, 198, 198]}

Gets a list of rgba values

iex> Imago.test_image() |> Imago.read_pixels_rgba |> Imago.slice5
{:ok, [198, 198, 198, 255, 198, 198]}

Since we use a 8x8 image, doctests would be polluted with lists of 4 * 64 integers. This ensures validity and conciseness. The real methods do return a list of integers.