Page 1 of 1

Combining section of multiple images into a new image.

Posted: 2012-07-02T02:49:34-07:00
by issle
I have a set of images ( lets call them source1.jpg source2.jpg source3.jpg etc ... ) and i want to crop a square area out of each image ( defined by x,y,width,height foreach image ) and then draw it on a shared canvas image at a specific point ( x,y ).

I can use convert -crop for each source image to get the section of the image i want into a seperate file and then composite -geometry to place it on the shared canvas image.

What i would like to know is if it is possible to do all this operation with one single command without having to generate intermediate files so as not to have IO overhead and so as not to have to execute multiple commands. I would much appreciate an example if possible.

Re: Combining section of multiple images into a new image.

Posted: 2012-07-02T10:33:39-07:00
by fmw42
You can cut and composite each image with the canvas in sequence in one command line. see http://www.imagemagick.org/Usage/layers/#convert

Put each image and the crop command in parenthesis. Be sure to add +repage after the crop.

see
http://www.imagemagick.org/Usage/basics/#parenthesis
http://www.imagemagick.org/Usage/crop/#crop_repage