Page 1 of 1

Insert an image into another

Posted: 2011-11-23T03:07:48-07:00
by elmazza
hi all,

im using imagemagick (v. 6.7.3 q16).

im very new at it.

my problem is the following: i have an image (let's say image.jpg).

what i want to do is to insert this image inside a white image in the center. i want the image.jpg to be opaque (the "white" of the other image if it's bigger than image.jpg it's going to be seen only in the outside area of image.jpg)

could you please give me some tips to solve this?

many thanks for your time ;)

Re: Insert an image into another

Posted: 2011-11-23T03:48:17-07:00
by Bonzo
There are a few different ways to do this; try:

Code: Select all

convert image.jpg white.jpg -gravity center -composite -matte output.jpg
You could add the white to the image ( extent needs to be the size of your white image ):

Code: Select all

convert image.jpg -background white -gravity center -extent 800x800 output.jpg

Re: Insert an image into another

Posted: 2011-11-23T03:56:11-07:00
by elmazza
many thanks!!

i think, meanwhile, i found another way as well eheh:

Code: Select all

composite -gravity Center image.jpg white.jpg result.jpg
many thanks for your answer!!!!!

Re: Insert an image into another

Posted: 2011-11-23T06:02:27-07:00
by Bonzo
As I said there are lots of ways to do what you wanted.
I tend to use convert as you could for example resize your image.jpg or add a border all within the same command which is not always possible with composite.