Colorized +/- difference between images

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Colorized +/- difference between images

Post by anthony »

The operation to find the difference bettween the to images is going to be tricky
but not imposible,

If you just subtract image A from B then the values will be B-A

If A is a larger value it will be clipped at zero. while is B is larger the vaue will
be the right difference. swapping the two images will generate negative difference
and clip the positive differences at zero.

the solution then becomes simple...

Code: Select all

     composite -compose subtract  A  B   blue.png
     composite -compose subtract  B  A   red.png
     convert  red.png  blue.png  -background black  -channel RB -combine  difference.png
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply