ImageMagick: How to compare source PNG with lost JPEG?

I want to compare the original PNG image with a lossy JPEG image to see how much I'm losing. I found that I can use ImageMagic to compare images. I prefer to use Java (im4java). I am very confused by their documentation (http://www.imagemagick.org/ script / compare.php). It does not describe what platform it is intended for. How to use these command lines and they are available even in im4java? If someone can write steps on how I use it, I would appreciate it.

+3
source share
3 answers

ImageMagick runs on many platforms. If you click Binary Releases , they have a list of available packages. The library im4java, as its home page describes, calls ImageMagick command-line tools to do its job, so it will work on any platform that supports both ImageMagick and Java. Looking through the API documentation , it looks like the command is comparenot available in im4java, so you have to modify im4java to support it.

+1
source

So why can't you use the ImageMagick command-line tool directly?

, compare , ( x ) . compare , .

:

 compare \
       -verbose \
       -debug coder \
       -log "%u %m:%l %e" \
        orig1.png \
        orig2.jpeg \
       -compose src \
        diff.png

2 : orig1.png orig2.jpeg. diff.png . stdout. , , .

- :

 compare \
       -verbose \
       -debug coder \
       -log "%u %m:%l %e" \
        orig1.png \
        orig2.jpeg \
       -compose difference \
        diff.png

-. , , :

 compare \
       -verbose \
       -debug coder \
       -log "%u %m:%l %e" \
        orig1.png \
        orig2.jpeg \
       -compose difference \
        x:
+1

My blog post is more about JPEG quality and what is the difference between ImageMagick and Lightroom , but you can find a useful command line that makes the required comparison:

composite image1.ext image2.ext -compose difference diff.png

Make sure you use .png (or .gif or another lossless format) as the output image, because you are primarily interested in the difference, and .jpg will distort it as a photo.

0
source

All Articles