Page 1 of 1

Composite PNG and Background

Posted: 2015-01-21T07:40:02-07:00
by oceanthrsty
My background can be any JPG or GIF of pretty much any size. I need to lay a PNG on it, centered and touching the bottom edge.

The PNGs are HUGE. So when I composite them, the PNG is not resized, it's just cut out to match the background size

What I've got now is:

Code: Select all

composite -gravity center person.png background.jpg result.jpg
I know I need a resize in there, but I don't know how to size it to match.

Windows
IM 6.9

Re: Composite PNG and Background

Posted: 2015-01-21T08:19:35-07:00
by snibgo
centered and touching the bottom edge
This is "-gravity south", not "-gravity center".

I would use "convert", not "composite". Eg for Windows BAT:

Code: Select all

convert background.jpg ( person.png -resize X%% ) -gravity South -composite result.jpg
The value of X might be, for example, the height of background.jpg divided by the height of person.png, multiplied by 100 or 90. Do this in a script.

Re: Composite PNG and Background

Posted: 2015-01-21T09:20:50-07:00
by oceanthrsty
Awesome... that works great!

Thanks!