Page 1 of 1

Composite of two images - but top image can be any size

Posted: 2014-12-19T15:08:03-07:00
by oceanthrsty
So I have a background jpg that is 1500w x 2100h. But this can be adjusted to whatever I need. I've thought just maybe making it 2100x2100.

I want to be able to take a horizontal or vertical main image and place it on top but no matter the size (could be coming in as 3:2 or maybe a pano) be able to make it fit with a border of at least 200px.

Examples of what the output should be:
Vertical Image coming in:
Image

I've started with code that looks like this:

Code: Select all

convert bg.jpg puppy.jpg  -geometry '1900x1900<' -gravity center -composite output.jpg
But I don't know how to account of veri & horizontal. The goal is then to output the image and then print it as a 5x7 print.

Sorry if I'm being vague. just began learning all of the ins an out of IM.

Re: Composite of two images - but top image can be any size

Posted: 2014-12-19T15:37:58-07:00
by fmw42
It is not clear to me what you are trying to do. Can you explain a bit further?

Also you should not use -geometry to resize an image. Use -resize and put it with the image to be resized in parentheses. geometry is primarily for offsetting the pixture relative to your gravity setting. Something like

unix syntax

Code: Select all

convert bg.jpg \( puppy.jpg  -resize '1900x1900<' \) -gravity center -composite output.jpg
window syntax

Code: Select all

convert bg.jpg ( puppy.jpg  -resize '1900x1900<' ) -gravity center -composite output.jpg
You should always provide your version of IM and platform when asking questions.

A good place to start with IM is:
http://www.imagemagick.org/Usage/
http://www.imagemagick.org/Usage/reference.html

Re: Composite of two images - but top image can be any size

Posted: 2015-03-06T10:04:53-07:00
by oceanthrsty
Basically I need to take a JPG image of unknown size or aspect ratio. Shrink it so the long edge is no bigger then 1680px. Then drop it, centered, onto a background of known size (2100H x 1500W).

I hope that is more clear. And thank you for your mention about not using geometry.

Using IM 6.9.0.9.