How IM determine output size of image?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
pictogram
Posts: 17
Joined: 2010-03-23T14:19:21-07:00
Authentication code: 8675308

How IM determine output size of image?

Post 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?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How IM determine output size of image?

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
pictogram
Posts: 17
Joined: 2010-03-23T14:19:21-07:00
Authentication code: 8675308

Re: How IM determine output size of image?

Post by pictogram »

Thanks a lot. Inbetween i found an example using "-flatten". Is this just another way to do it?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How IM determine output size of image?

Post 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
Post Reply