imago v0.2.15 Imago View Source

Link to this section Summary

Functions

Applies a bayer filter to an image

Applies a floyd-steinberg filter to an image

Re-saves an image as a jpeg.

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

Saves a PGM image to the given path

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.

Applies a threshold filter to an image

Link to this section Functions

Link to this function

dither_bayer(path, threshold) View Source

Applies a bayer filter to an image

iex> Imago.test_image() |> Imago.dither_bayer(128) |> Imago.slice5
{:ok, {64, 64, [0, 0, 0, 0, 0, 0]}}
Link to this function

dither_floyd_steinberg(path, threshold) View Source

Applies a floyd-steinberg filter to an image

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

Re-saves an image as a jpeg.

iex> Imago.test_image() |> Imago.flatten_as_jpg
{:ok, "/home/lucas/Bureau/DIVERS_EN_COURS/Imago/lib/../test_image.jpg.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.slicefp5
{: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.slicefp5
{: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, {64, 64, [255, 255, 255, 255, 255, 255]}}

Gets a list of blue values

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

Gets a list of green values

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

Gets a list of red values

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

Gets a list of rgb values

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

Gets a list of rgba values

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

Saves a PGM image to the given path

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 function

threshold(path, threshold) View Source

Applies a threshold filter to an image

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