Page 1 of 1

crop inside a composite image

Posted: 2008-01-22T16:37:31-07:00
by babwar
hello,

I have a little problem using imagemagick.

What i want to do is create an image with x images.

It is working perfectely like this :

convert -size 285x285 xc:#1582cb \
image1.jpg -geometry 129x65+13+15 -composite \
image2.jpg -geometry 114x51+159+217 -composite \
final.jpg

But it take exactely image1.jpg and image2.jpg. I want to make a crop from this images in add.

Thanks for your answers..

Re: crop inside a composite image

Posted: 2008-01-23T06:38:30-07:00
by babwar
I add an image to make it clear :

I want to create a background blue and depose inside 2 images that i can dispose where I want. I can in the same time crop this images.

Exemple in image :

Image

How can i do this in one command line ?

Re: crop inside a composite image

Posted: 2008-01-30T19:27:01-07:00
by anthony
You can crop images when reading them using special image read modifiers. These include, resizing, or cropping the images being read. To do both use the crop method, the resize.
http://imagemagick.org/Usage/files/#read_mods

the alturnative is to use parenthesis to process just the one image before adding it to the canvas.

Code: Select all

   convert canvas.png \
           ....
           \( new_image.jpg  -crop 100x100+20+30 +repage \
                    -resize 50x50   -repage +300+200 \) \
           ....
           -flatten   result.png
Parenthesis... http://imagemagick.org/Usage/basics/#parenthesis
the -flatten is type of multi-image -composition operator.
See Image layering http://imagemagick.org/Usage/layers/
It also can create a background canvas of a specific size, basied on the virtual canvas size of the first image in the image sequence.

Basically you have only just scratched teh surface of multi-image compositions.