You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The upcoming image version 0.34 includes Image.compare/3 which brings it closer (but not completely) to ImageMagick. One of the requirements stated has been to build a "difference image" that shows what pixels are different between the two images. Here is an example:
# Image 2 is the same image, only with a cat overlayed upon it.iex>cat=Image.open!"./test/support/images/cat.png"iex>image_2=Image.compose!(i,cat,x: :middle,y: :center)|>Image.flatten!
# Now we can compare the image with the defaults of # `metric: :ae, difference_color: :red, saturation: 1.0, brightness: 1.0, difference_boost: 1.5`iex>{:ok,metric,difference_image}=Image.compare(image_1,image_2){:ok,0.13152029520295203,%Vix.Vips.Image{ref: #Reference<0.1501890617.2351562776.180408>}}
# Note how the pixels that were different between the two images are masked in red overlaid on the original image. Its possible to adjust the brightness and saturation of the base image and to boost them for the difference pixels. Here's an example:iex>{:ok,metric,difference_image}=Image.compareimage_1,image_2,brightness: 0.5,saturation: 0.2,difference_boost: 2.0{:ok,0.13152029520295203,%Vix.Vips.Image{ref: #Reference<0.1501890617.2351562776.180435>}}
Note how the difference pixels stand out more strongly. You can also see there is a color gradient to the difference pixels. The shading indicates how much different (mathematical difference, not perceptual difference) the pixels are.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The upcoming
imageversion 0.34 includesImage.compare/3which brings it closer (but not completely) to ImageMagick. One of the requirements stated has been to build a "difference image" that shows what pixels are different between the two images. Here is an example:Note how the difference pixels stand out more strongly. You can also see there is a color gradient to the difference pixels. The shading indicates how much different (mathematical difference, not perceptual difference) the pixels are.
Beta Was this translation helpful? Give feedback.
All reactions