Newbie Question - Overlay and scale 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
User avatar
rossmcm
Posts: 28
Joined: 2012-07-26T06:10:38-07:00
Authentication code: 15
Location: Auckland, NZ

Newbie Question - Overlay and scale images

Post by rossmcm »

I have just discovered ImageMagick. Pretty amazing so far. I've already struck the first thing I can't do.

I have ImageA.png and ImageB.png. Both are 100x100 and have transparent backgrounds.

I want to produce ImageC.png, also with a size of 100x100.

I want ImageC to consist of ImageA with ImageB overlaid on top of it, but ImageB is to be reduced 50% and positioned in the bottom right-hand corner, i.e. with an offset of +50+50.

Code: Select all

convert -page +0+0 "ImageA.png" -page +50+50 "ImageB.png" -resize 50% -background None -layers merge +repage "ImageC.png"

almost works but both images are scaled, not just ImageB, and the canvas shrinks to 75x75.

Any help appreciated. I would also appreciate the general syntax for overlaying N successive images, each with its own offset and scaling.

TIA
R
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Newbie Question - Overlay and scale images

Post by Bonzo »

Try with brackets; on windows you do not need to escape the brackets with a \ but on Linux you need \( \)

Code: Select all

convert -page +0+0 "ImageA.png" -page +50+50 \( "ImageB.png" -resize 50% \) -background None -layers merge +repage "ImageC.png"
Post Reply