Merge multiple 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
mikolaskova
Posts: 8
Joined: 2010-11-21T14:35:44-07:00
Authentication code: 8675308

Merge multiple images

Post by mikolaskova »

Hello,

what is the best way to merge multiple images in to one- i want to have the same effekt like putting them in different layers in gimp and merge them.
the images (png) have transparent areas.

I tried composite with different options but either not all where merged or the images just gets black.

( composite *.png out.png)

Best Regards

Adriana
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Merge multiple images

Post by fmw42 »

try (assuming they are all the same size)

convert *.png -background none -flatten out.png

see
http://www.imagemagick.org/Usage/layers/#flatten
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Merge multiple images

Post by anthony »

Or if with offsets, use -layers merge which will expand the canvas in all directions preserving the offsets.

See Layering Images, whcih deals with this type of thing.
http://www.imagemagick.org/Usage/layers/

Can you be a little clearer in exactly how the images are being 'merged'.
Real images? Distortions? Offsets (known or unknown)? Overlaps?
How extensive is the transparent areas?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
mikolaskova
Posts: 8
Joined: 2010-11-21T14:35:44-07:00
Authentication code: 8675308

Re: Merge multiple images

Post by mikolaskova »

Thank you very much. It worked and I will read about the layers!
Best regards
Adriana
(I'm trying out different methods. Ihave hundreds of images with written text and I want to experiment with them- the aim is to create an animation. The single frames will be different combination of layered text-pages. So I have to figure out how to filter out the non-text-areas, how I can addapt the text-color to a similar value etc.)
mikolaskova
Posts: 8
Joined: 2010-11-21T14:35:44-07:00
Authentication code: 8675308

Re: Merge multiple images

Post by mikolaskova »

hello,

how can I change the order of the layers? Do I have to rename the files first? or is there an other way to influence which image comes to upper layer and which to the layers underneath?

Best regards

Adriana
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Merge multiple images

Post by fmw42 »

They are normally layered in the order listed in the command line. You can adjust the order using -swap, -insert, -delete etc. see http://www.imagemagick.org/Usage/basics/#list_ops
mikolaskova
Posts: 8
Joined: 2010-11-21T14:35:44-07:00
Authentication code: 8675308

Re: Merge multiple images

Post by mikolaskova »

Thank you very much!
Post Reply