Is it possible to save the differences between an image and a list of 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
Shizu
Posts: 4
Joined: 2017-09-28T03:26:16-07:00
Authentication code: 1151

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

Post 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
Last edited by Shizu on 2017-09-29T05:45:09-07:00, edited 2 times in total.
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

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

Post 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
Shizu
Posts: 4
Joined: 2017-09-28T03:26:16-07:00
Authentication code: 1151

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

Post 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
Post Reply