Merging images, one img over another over a background img

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
silversonicaxel
Posts: 10
Joined: 2013-12-19T07:00:20-07:00
Authentication code: 6789

Merging images, one img over another over a background img

Post by silversonicaxel »

Hi guys,
I'm kinda new on imagemagick composition, i explain you my problem.
My goal is a postcard, i have some images and i have to put them one over another.
at first I've a background photo large 500x250 pixel with a 5pixel white border, and over the background I should put some rectangles or circles for the other photos, still white bordered.

Code: Select all

convert.exe -size 600x357 -border 7 -bordercolor White smallPhoto.jpg background.jpg -composite -matte  postcard.jpg
I started to use this command, but it's already wrong the dimension of the picture, that is sized as the smallPhoto.jpg is, not as background.jpg is or as i specified -size 500x250 on the command.

what's wrong with it?
thanks in advance
Last edited by silversonicaxel on 2013-12-19T07:50:17-07:00, edited 2 times in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Multilayer image, one img over another over a background

Post by snibgo »

"-size" is a setting for some operation, but you have none of those operations.

"-border" will create a border on an image, but you have no image yet.

"-bordercolor" is a setting for "-border", so needs to be before it.

"-matte" is a deprecated command. Use "-alpha set" instead. But it has no effect where you have placed it.
snibgo's IM pages: im.snibgo.com
silversonicaxel
Posts: 10
Joined: 2013-12-19T07:00:20-07:00
Authentication code: 6789

Re: Multilayer image, one img over another over a background

Post by silversonicaxel »

great explanation, but it still does not solve my problem.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Merging images, one img over another over a background i

Post by snibgo »

You have two input images, both opaque. I assume that smallPhoto.jpg is smaller than background.jpg, and you want it placed centrally.

Code: Select all

convert background.jpg smallPhoto.jpg -gravity center -composite -bordercolor white -border 7 postcard.jpg
snibgo's IM pages: im.snibgo.com
Post Reply