: Imagemagick: how to compare two images and obtain a third image with the differences? Anyone knows how to make imagemagick output an image with the differences between two other images? Similar
Anyone knows how to make imagemagick output an image with the differences between two other images? Similar to a diff, but not exactly the same. Any other Windows/Linux commandline tool that can be scripted would be good too (because I need to do this with hundreds of images).
Quick and dirty example:
Let's say I have these two images:
And I need to obtain only the curtain (and any other differences if there were), with everything else transparent.
More posts by @RJPawlick971
1 Comments
Sorted by latest first Latest Oldest Best
It's the first example in the ImageMagick documentation:
magick compare -compose src du2SX.png ejUjy.png difference.png
magick difference.png -transparent "#CCCCCC" alpha.png
In "difference.png" the identical pixels are rendered in mid-gray:
The second command makes those pixels transparent:
Using +transparent instead of -transparent inverts things so you get:
Finally, use this as a mask
magick composite -compose copy_opacity alpha.png du2SX.png result.png
to get:
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.