Reputation: 549
On Windows 10, I have installed ImageMagick, Version 7.1.1-Q16-HDRI.
I have a high resolution .png image that I convert to jpg with 75% quality:
magick myImage.png -quality 75 myImage.jpeg
Now I want to calculate SSIM to judge the quality of the .jpeg in comparison to the original .png.
First, I am using ffmpeg.exe version 4.2.3 from the very same ImageMagick installation:
ffmpeg.exe -i myImage.jpeg -i myImage.png -lavfi ssim=stats_file=ssim_logfile.txt -f null -
Results in ssim_logfile.txt:
n:1 Y:0.959684 U:0.957603 V:0.976335 All:0.962112 (14.215018)
So I assume that the SSIM value has been calculated as 0.962112
Now I'll use magick to calculate the same metric:
magick myImage.jpeg myImage.png -metric SSIM -compare -format "%[distortion]" info:
Output is:
0.925167
That's a huge difference! So I think I'm making an error here with one or the other way.
What is the correct way to calculate SSIM?
Upvotes: 1
Views: 373