Page 1 of 1
Contradicting "Compare" results
Posted: 2016-09-05T22:46:31-07:00
by BzzBzz
Hello.
I'm a bit confused by results produced by "compare" tool. I used random jpeg image (doesn't actualy matter which one, I tested few and all of them produce same results). I named it original.jpg. Then I converted it to png using photoshop (ps-conv.png) and "convert original.jpg im-conv.png"
Now I used "compare"
compare original.jpg ps-conv.png ps-compare.png
compare original.jpg im-conv.png im-compare.png
"im-compare.png" shows no difference (as expected) but there's some difference in "ps-compare.png".
But comparing original.jpg, ps-conv.png, im-conv.png using photoshop shows INVERTED results. Photoshop claims that there's NO difference between original.jpg and ps-conv.png BUT there's SOME difference in original.jpg and im-conv.png.
Can someone explain why is this happens and which one should I trust converting my images? Or did I miss some switches converting or comparing images?
I'm sorry if this was asked before :/ Can't find anything related.
Re: Contradicting "Compare" results
Posted: 2016-09-05T23:20:36-07:00
by snibgo
To summarise:
1. When you convert jpeg to png using IM, then IM says they are identical but PS doesn't.
2. When you convert jpeg to png using PS, then PS says they are identical but IM doesn't.
Correct? Each system is effectively doing the same conversion twice, so reasonably enough gets the same results each time.
But an IM conversion jpeg->png seems to give a different result from PS conversion jpeg->png. Questions are: how different are they, and why? I don't have PS so can't investigate. Perhaps you can post an original and both conversions here.
If the original isn't sRGB, and has an embedded colorspace, then they will be different unless they convert to identical sRGB profiles (and there may be trivial arithmetic differences).
If one output is 8 bits/channel/pixel but the other is 16, they could be slightly different.
Re: Contradicting "Compare" results
Posted: 2016-09-05T23:23:50-07:00
by fmw42
Post your 3 or 4 input image and we can test. Also provide your IM version and platform? Are the image exactly the same size. You have not specified a -metric value for IM, so I am not sure what the default value is nor what PS-compare uses.
Are any of you images transparent? IM generally does not include the transparent channel in the comparison.
Re: Contradicting "Compare" results
Posted: 2016-09-06T00:33:02-07:00
by BzzBzz
snibgo wrote:To summarise:
1. When you convert jpeg to png using IM, then IM says they are identical but PS doesn't.
2. When you convert jpeg to png using PS, then PS says they are identical but IM doesn't.
Correct?
Yes, exactly.
fmw42 wrote:Post your 3 or 4 input image and we can test. Also provide your IM version and platform? Are the image exactly the same size. You have not specified a -metric value for IM, so I am not sure what the default value is nor what PS-compare uses.
Are any of you images transparent? IM generally does not include the transparent channel in the comparison.
Not sure what metric is, I used minimum set of command line arguments like "convert file.jpg file.bmp" and "compare file1 file2 file3"
compare -h says "Version: ImageMagick 6.9.1-3 Q16 i686 2015-07-01
http://www.imagemagick.org"
I use it under cygwin environment in Win7 x64.
For testing purposes I used random image from imgur -
http://i.imgur.com/F5iJY.jpg
I switched to bmp from png as there's different sets of chuncks in pngs produced by PS and IM, and seems IM adds transparency layer for whatever reason. But BMPs shows same result - decompressed images are diffferent (I don't know how big difference is and for what reason, that's why I made this topic).
Can't attach files so external hosting -
http://s000.tinyupload.com/index.php?fi ... 3661357739
Content of test.zip:
F5iJY.jpg - original jpeg from imgur
F5iJY.ps.bmp - jpeg converted to bmp by PS (file -> open -> (jpeg file) -> file -> save as -> (bmp file)
F5iJY.im.bmp - jpeg converted to bmp by IM (convert F5iJY.jpg F5iJY.im.bmp)
compare.png - bmp comparison (compare F5iJY.im.bmp F5iJY.ps.bmp compare.png)
Re: Contradicting "Compare" results
Posted: 2016-09-06T01:07:45-07:00
by snibgo
The difference between F5iJY.ps.bmp and F5iJY.im.bmp is very small, RMSE difference of 0.394%, which is pretty much 1 part in 256. I suspect it is a rounding difference in the calculation from YCbCr colorspace to sRGB, eg IM works in floating point but PS work in integers.
EDIT: the precision is limited to the 8-bit outputs, of course. Try saving to a 16-bit/channel format, such as PNG or TIFF.
Re: Contradicting "Compare" results
Posted: 2016-09-06T01:45:17-07:00
by BzzBzz
Unfortunately I use Photoshop Elements that doesn't work in 16-bit/chanel mode so I can't test it. But if it looks like rounding error that's good
Thank you very much for your quick help.
Re: Contradicting "Compare" results
Posted: 2016-09-06T02:33:53-07:00
by snibgo
Yes, I'd say it's an insignificant difference in rounding. This is less than 0.4% RMSE. I reckon that when a difference is 1% or less, evenly distributed in an ordinary photo, the images will look the same.
Try this:
Code: Select all
convert F5iJY.ps.bmp F5iJY.im.bmp -compose Difference -composite -auto-level diff.png
The lightest parts of diff.png have the greatest difference. We see the difference isn't exactly evenly distributed, but forms a 16x16 grid pattern, corresponding to jpeg compression.
Even when I know where the worst differences are, I can't see them on a blink comparison of the BMP images.