amitdar
amitdar

Reputation: 927

show only difference using imagemagick compare

I'm using ImageMagick compare to compare two images and get their diff. I have 2 questions:

  1. I want to get a transparent result image with only the diff parts, nothing else. Not white - transparent.
  2. Is it possible to get the diff of only one image instead of both ?

Thanks!

Upvotes: 0

Views: 579

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 207425

Let's suppose you start with these two images:

convert -size 256x256 xc:black -fill white -draw "circle 100,100 120,100" a.png

enter image description here

and

convert -size 256x256 xc:black -fill white -draw "circle 120,120 140,140" b.png

enter image description here

Then you can get the differences in red on a transparent background like this:

compare a.png b.png -highlight-color red -lowlight-color none -compose src diff.png

enter image description here

I have overlaid it onto a checkerboard like Photoshop does so you can see the checkerboard through the transparency.

As regards your second question, I have no idea how you can get the difference between a single image? Difference from what?

Upvotes: 3

Related Questions