Page 1 of 1

imagemagick composite multiple images

Posted: 2020-01-17T23:56:15-07:00
by ifkey
Hello
I have a lot of files in my folder 1,2,3,4,5,6,7 .... PNG and 1,2,3,4,5,6,7 .... tiff and I need to merge them

Code: Select all

composite * .png * .tif *.png
does not work
ImageMagick 7.0.8-49 Q8 x64

Re: imagemagick composite multiple images

Posted: 2020-01-18T00:14:30-07:00
by snibgo
What is your platform (Windows, bash, etc?). How large are your inputs?

If the inputs are small enough to fit into memory at the same time, you could use "-layers composite", like this:

Code: Select all

magick *.tif NULL: *.png -layers Composite out_%d.png
Otherwise, you could write a shell loop, so the magick command in the loop operated on only a single pair of files.

Re: imagemagick composite multiple images

Posted: 2020-01-18T00:15:12-07:00
by fmw42
Can you explain more about how you want to merge them? Are you trying to overlay the PNG on the TIFF or put them side by side? Are the images the same size? Do they have transparency? Perhaps post and example input pair and your desired output image.

You cannot use wild cards in ImageMagick commands that way as both input and output. Even if you could, wild cards should not have spaces after the *.

If you are overlaying them you can use -layers composite as described for animation merging. See https://imagemagick.org/Usage/anim_mods/#merging

Code: Select all

magick *.tiff null: *.png -layers composite result.png
should work and created result-0.png, result-1.png ...