Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.

The desired effect I'm trying to get is a result image that only has the pixels present in all inputs. So if I fed img1, img2, img3, and img4 into the above command I was running, the output file would have an image with only the pixels found in every image, and the pixels that conflicted would be of another color, such as pink.

The output file I was given above was as a result of running "-evaluate-sequence OR". I too thought that the desired evaluate sequence to get the effect I wanted was "AND", but using AND gave me an image with every pixel of all images stacked on top of one another (perhaps AND and OR are mixed up?)

Note that you could have used compare also to show only where they are different. But JPG is lossy and the two images won't be identical even where they look the same due to JPG compression. So that is why I had to threshold above and have to use -fuzz below.

Note that you could have used compare also to show only where they are different. But JPG is lossy and the two images won't be identical even where they look the same due to JPG compression. So that is why I had to threshold above and have to use -fuzz below.

The red shows the difference and the rest of the image is subdued in contrast simply to show the image, but if it is not red, then it means the two are the same (within the fuzz value).

Thanks for the quick reply, Fred.

Is there any way you could do a quick explanation of what your second convert script is doing? That's pretty similar to what I want to do. If not, that's understandable and I can dissect the pieces myself.

Another question: Could that convert script support more than two inputs? Or is the -compose difference limited to one image compared to one other?

Ultimately, I want to build a script that will accept ~1000 images (in batches), and create a "template" image that contains only the pixels present in all images, except where there was variance between the images a color would be displayed such as red below. After this template is obtained, I want to check if another input image contains at least all the pixels present in the template, including white pixels.

I apologize if my posts have been unclear, English isn't my first language and I'm new to IM!

Line1: read image1
Line2: copy image1 and read image2 and get the difference, threshold at 10% to make binary and avoid JPG compression difference and negate (invert black vs white)
Line3: put the binary image into the alpha channel to make the differences transparent
Line4: set the background to red, make the compose setting to over, since it affects the flatten operator and flatten the result agains the the background so that transparent becomes red
Line5: write the output

Post 4 or 5 or 6 images that you want to compare. I will try to write a script that will compare them sequentially and keep adding to the difference mask.

Hey Fred, thanks again for the tremendous help. I could definitely try to figure it out myself! If you're still compelled to write such a script, I made an imgur album with 5 pictures you could try on:

This will loop over each image and compare to the first saving the difference as black in a white image. It multiplies each difference with the previous to note all the successive differences as more black and saves the result as mask.png. Then after the loop is done I use the mask to write red where the mask was black onto the first image.

This will loop over each image and compare to the first saving the difference as black in a white image. It multiplies each difference with the previous to note all the successive differences as more black and saves the result as mask.png. Then after the loop is done I use the mask to write red where the mask was black onto the first image.