SnappyImageDiff (snappy_image_diff v0.1.0)

Summary

Functions

Compare two images and return a tuple with the result.

Compare two images and return a tuple with the result.

Functions

Link to this function

diff(before_path, after_path)

Compare two images and return a tuple with the result.

And differences will be written to a file in the same directory as the before image with the suffix -diff.

Link to this function

diff(before, after, output_path)

Compare two images and return a tuple with the result.

And differences will be written to the path specified by output_path.

Returns {:ok, :images_match} if the images are identical. Returns {:error, :dimension_mismatch} if the images are different sizes. Returns {:error, :different, score, diff_location} if the images are different.

Examples

iex> SnappyImageDiff.diff("test/fixtures/1a.png", "test/fixtures/1a.png", "some_destination.png")
{:ok, :images_match}

iex> SnappyImageDiff.diff("test/fixtures/6a.png", "test/fixtures/6a_cropped.png", "some_destination.png")
{:error, :dimension_mismatch}

iex> SnappyImageDiff.diff("test/fixtures/1a.png", "test/fixtures/1b.png", "test/fixtures/1a-diff")
{:error, :different, 0.9833533452322089, "test/fixtures/1a-diff.png"}