Page 1 of 1

Is it possible to save the differences between an image and a list of images?

Posted: 2017-09-28T04:02:54-07:00
by Shizu
Hello, I've been using the command line in this thread to save the differences between 2 images like this:
#1Image
#2Image
Output of #1 and #2:
Image

I want to ask if it's possible to convert between 1 image to all the images in the same folder (1 image each time)?
Example:
#3Image
#4Image

I want the cmd to output the result of #1 and #2, #1 and #3, #1 and #4, #1 and....(the rest images in the same folder).

Can anyone help me with this? Thank you very much~
I'm using IM 7.0.7-4 on Windows 7.

Update:
All of the imgs is in lossless .png, you can save the samples here: Link to Imgur.com

I'm using this code, the output img's size is reduced and the background is transparent.

Code: Select all

convert img2.png img1.png -alpha off +repage ( -clone 0 -clone 1 -compose difference -composite -threshold 0 ) ( -clone 0 -clone 2 -compose multiply -composite ) -delete 0,1 +swap -alpha off -compose copy_opacity -composite +repage output.png

Re: Is it possible to save the differences between an image and a list of images?

Posted: 2017-09-28T05:23:48-07:00
by GeeMack
Shizu wrote: 2017-09-28T04:02:54-07:00I want the cmd to output the result of #1 and #2, #1 and #3, #1 and #4, #1 and....(the rest images in the same folder).
If your system has enough memory to read in all the images in the folder, you should be able to get very nearly that result with a command like this...

Code: Select all

magick *.jpg -write mpr:list -delete 1--1 null: mpr:list[1--1] ^
  -compose difference -layers composite -modulate 100,100,0 -negate output-%03d.png

Re: Is it possible to save the differences between an image and a list of images?

Posted: 2017-09-28T11:04:33-07:00
by Shizu
Thank you for the fast reply but it didn't work. All the output imgs become like this:
Image

I'm using this code to crop out the differences between 2 images, leaving the background transparent and reduce the size of the output image:

Code: Select all

convert img2.png img1.png -alpha off +repage ( -clone 0 -clone 1 -compose difference -composite -threshold 0 ) ( -clone 0 -clone 2 -compose multiply -composite ) -delete 0,1 +swap -alpha off -compose copy_opacity -composite +repage output.png
Btw, the images is in lossless .png, you can save the samples here: Link to Imgur.com