Super impose

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
foruforewer
Posts: 26
Joined: 2011-02-08T04:37:21-07:00
Authentication code: 8675308

Super impose

Post by foruforewer »

Dear Friends,

I want to superimpose two images, second image is 25% resized of original only. Now each time I try to superimpose, it does it with center alignment only. I want to offset it by few pixels. I had tried geometry switch but it is not working for me. Surely I am missing something somewhere please guide me.

Code : In which I am passing file name with %1

convert %1 -resize 25%% r_%1
convert %1 r_%1 -compose Multiply -gemometry -50 -50 -composite n_%1
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Super impose

Post by fmw42 »

convert %1 r_%1 -compose Multiply -gemometry -50 -50 -composite n_%1
do not separate -compose ... -composite, put the -geometry before the -compose

also no space between coordinate offsets in -geometry


try

convert %1 r_%1 -gemometry -50-50 -compose Multiply -composite n_%1

or if you want it centered


convert %1 r_%1 -gravity center -gemometry -50-50 -compose Multiply -composite n_%1
foruforewer
Posts: 26
Joined: 2011-02-08T04:37:21-07:00
Authentication code: 8675308

Re: Super impose

Post by foruforewer »

Thank you for reply.

My image is of 337x337 and second image is of 84x84 and I want to shift second image by 34 pxl vertically down and super impose. Than which coordinate should I give, can you please elaborate calculation to derive pixel to be given
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Super impose

Post by fmw42 »

I assume that %1 is the big image and r_%1 is the smaller image to be put on top of the larger image. If the other way, then switch the two input images.


If relative to the top left:

convert %1 r_%1 -geometry -0-37 -compose over -composite n_%1



If relative to the center:

convert %1 r_%1 -gravity center -geometry -0-37 -compose over -composite n_%1


see http://www.imagemagick.org/Usage/layers/#convert
Post Reply