Page 1 of 1
Comparing 2 Images
Posted: 2013-11-08T11:48:53-07:00
by LemmingOnTheRun
I have 2 .png files that I want to compare. After using compare I get a working image as expected, but I want more data than this. Is there any way to get compare to spit out the actual values (how many red pixels became green, how many green pixels became yellow, etc)? If so is there any way to then DISPLAY these values in the resulting image?
Version: ImageMagick 6.8.7-0 2013-09-18 Q16
Re: Comparing 2 Images
Posted: 2013-11-08T12:26:14-07:00
by fmw42
can you post links to your two images so we can try some things? you can post to some free service such as dropbox and then put links here.
Re: Comparing 2 Images
Posted: 2013-11-08T14:08:11-07:00
by snibgo
There are many possibilities, such as:
- Use "compose difference" (or minus) to see what pixels have changed.
- Use "-separate" to see the differences per red, green or blue channel.
- Create a mask to show just the changed pixels, or just the pixels where the green channel has changed, or just where the green channel has increased.
Re: Comparing 2 Images
Posted: 2013-11-11T08:47:17-07:00
by LemmingOnTheRun
Here's a link to some examples. Also these were converted from svg files, and any tips on getting rid of that black stuff (not in the original svg file) would be appreciated...
https://www.dropbox.com/sh/i07yphgrk625bre/i4FCGjcO5E
Re: Comparing 2 Images
Posted: 2013-11-11T09:32:22-07:00
by snibgo
With current Inkscape (0.48) and recent IM (v6.8.7-0) I get no black bits, using convert with no options.
Code: Select all
convert example.svg e0.png
convert example_template.svg e1.png
Re: Comparing 2 Images
Posted: 2013-11-11T10:58:26-07:00
by fmw42
Here is one method. Remap the colors to the basic colors to fill in the anti-aliased colors. Then get the histogram. It shows the counts of each color
convert xc:white xc:black xc:"#41ff1a" xc:"#f50015" xc:"#fcff24" +append map.png
convert example.png +dither -remap map.png -depth 8 -format "%c" histogram:info:
3311: ( 0, 0, 0,255) #000000 black
5083: ( 65,255, 26,255) #41FF1A srgba(65,255,26,1) ----> green
1715: (245, 0, 21,255) #F50015 srgba(245,0,21,1) ----> red
4229: (252,255, 36,255) #FCFF24 srgba(252,255,36,1) ---->yellow
768350: (255,255,255,255) #FFFFFF white
Re: Comparing 2 Images
Posted: 2013-11-14T11:21:09-07:00
by LemmingOnTheRun
That's a cool idea, but it doesn't preserve location within the image. (like, I need to know where in the image the colors changed). I'll take a look at it tho, definitely seems useful
EDIT: compose was exactly what I was looking for, thanks! I'll have to play with this and write a script that integrates the visual and histogram components, but this should work perfectly, thanks everyone!