SnappyImageDiff (snappy_image_diff v0.2.1)
Summary
Functions
Compare two images and return a tuple with the result.
Compare two images and return a tuple with the result.
Compare two images and return a tuple with the result.
Functions
diff(before_path, after_path)
Compare two images and return a tuple with the result.
Any differences will be written to a PNG file in the same directory as the
before
image with the suffix -diff
.
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.
diff(before, after, output_path)
Compare two images and return a tuple with the result.
Any differences will be written to a PNG file 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"}
score(before, after)
Compare two images and return a tuple with the result.
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.score("test/fixtures/1a.png", "test/fixtures/1a.png")
{:ok, :images_match}
iex> SnappyImageDiff.score("test/fixtures/6a.png", "test/fixtures/6a_cropped.png")
{:error, :dimension_mismatch}
iex> SnappyImageDiff.score("test/fixtures/1a.png", "test/fixtures/1b.png")
{:error, :different, 0.9833533452322089 }