Page 1 of 1

Super impose

Posted: 2011-08-05T02:39:31-07:00
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

Re: Super impose

Posted: 2011-08-05T09:28:51-07:00
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

Re: Super impose

Posted: 2011-08-06T03:32:55-07:00
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

Re: Super impose

Posted: 2011-08-06T09:47:58-07:00
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