Cited from https://rosettacode.org/wiki/Percentage_difference_between_images#Python.
I chose PYTHON script. But the script has some problem. I need to change “import Image” to “From PIL import Image”.
The output will give the pixel difference in percentage.
But I don’t understand the output. A more clear way is got from http://stackoverflow.com/questions/29229535/measure-similarity-of-two-images-in-java-or-imagemagick. In this method, the different pixel number will be output.
This used ImageMagick in Linux. The command to compare a.png and b.png is:
compare -metric ae a.png b.png null:
The output is the number of different pixel. If you want the percentage. You need to use the following command to get the X and Y for the image and use X*Y to calculate the total pixel. Then use the above result divided by the below result to get the percentage.