Page 1 of 1

How IM determine output size of image?

Posted: 2011-05-05T00:14:35-07:00
by pictogram
Hello,

i'm new to IM and now that i can mount two or more images together on a new, resulting image, which is pretty cool for me :-). But for now i use the -size operator to set the resulting image's size (as read from the examples).

Is it possible to place two or three images onto a "background image" without knowing it's size, so that the resulting image has the same dimension as the background image? And how to tell IM which image is the background image?

Re: How IM determine output size of image?

Posted: 2011-05-05T00:51:05-07:00
by anthony
The -layers merge will size the background image to fit the layer images it is accomidating.
However you will still need to position the images at least relative to each other.

See IM examples Laying, merge.
http://www.imagemagick.org/Usage/layers/#merge
And also the later examples of programmed positions.
http://www.imagemagick.org/Usage/layers/#layer_prog

Re: How IM determine output size of image?

Posted: 2011-05-05T07:18:09-07:00
by pictogram
Thanks a lot. Inbetween i found an example using "-flatten". Is this just another way to do it?

Re: How IM determine output size of image?

Posted: 2011-05-05T10:06:18-07:00
by fmw42
pictogram wrote:Thanks a lot. Inbetween i found an example using "-flatten". Is this just another way to do it?
-flatten is a shorthand for -layers flatten

see http://www.imagemagick.org/Usage/layers/#flatten, but I believe the first image's virtual canvas (page dimensions) determines the final size and any image outside the bounds will be truncated

If you want the canvas (background) to expand to hold all images, see -mosiac (-layers mosaic) http://www.imagemagick.org/Usage/layers/#mosaic

Also see -layers merge http://www.imagemagick.org/Usage/layers/#merge


Also see all methods at http://www.imagemagick.org/script/comma ... sl4#layers