Page 1 of 1

Merge three images at different positions on a transparent canvas

Posted: 2015-09-21T08:36:55-07:00
by 276QeqxYSCrFENSx
I have three PNGs that I want merged at different positions on a transparent canvas with a fixed size.

Let's say the canvas is 200x200, the images all about 50x50 and I want the first at 25x 125y, the second at 75x 125y and the third at 125x 125y. How would I go about this?

Example:

Image

Re: Merge three images at different positions on a transparent canvas

Posted: 2015-09-21T09:01:55-07:00
by snibgo
You might use "-layers" with a page setting, or "-composite" with a geometry.

Re: Merge three images at different positions on a transparent canvas

Posted: 2015-09-21T09:19:58-07:00
by fmw42

Re: Merge three images at different positions on a transparent canvas

Posted: 2015-09-22T02:14:01-07:00
by 276QeqxYSCrFENSx
snibgo wrote:You might use "-layers" with a page setting, or "-composite" with a geometry.
I couldn't get the canvas to be transparent. It always turns out black.

Code: Select all

convert --size200x200 xc:none output.png -composite 1.png -composite 2.png -composite 3.png

Re: Merge three images at different positions on a transparent canvas

Posted: 2015-09-22T07:15:37-07:00
by 246246
276QeqxYSCrFENSx wrote: I couldn't get the canvas to be transparent. It always turns out black.
You will need -background none. And output file should be placed last of the command sequence.

Code: Select all

convert xc:none[200x200\!] -background none \( rose: -resize 50x50\! -geometry +25+125 \) -compose over -composite \( rose: -resize 50x50\! -geometry +75+125 \) -compose over -composite \( rose: -resize 50x50\! -geometry +125+125 \) -compose over -composite show:
or

Code: Select all

convert xc:none[200x200\!] -background none \( rose: -resize 50x50\! -repage +25+125 \) \( rose: -resize 50x50\! -repage +75+125 \) \( rose: -resize 50x50\! -repage +125+125 \) -layers merge show:

Re: Merge three images at different positions on a transparent canvas

Posted: 2015-09-22T07:26:58-07:00
by 276QeqxYSCrFENSx
Thanks 246246, the first command is what I was looking for. It works with "gravity" and solves the problem.