chris01
chris01

Reputation: 12331

ImageMagick: resize a image and merge it with another

I try to merge 2 images (put the logo.png on top of pic.png) to a new file newpic.png.

convert pic.png logo_.png  -gravity southwest -compose over -composite newpic.png

But logo.png should be resized before the merge (not the file but the image that is used for the merge). I tried -resize and -size but both affected newpic.png.

Any idea how I can produce that?

Upvotes: 3

Views: 562

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 207465

Use parenthesised "aside processing" to ensure the resize operation only applies to the logo:

convert pic.png \( logo_.png -resize 80x40 \) -gravity southwest -compose over -composite newpic.png

Or, apply the resize while you only have one image loaded, then load the other image and swap the order ready for compositing:

convert logo.png -resize 80x40 pic.png +swap -gravity southwest -compose over -composite newpic.png

Upvotes: 5

Related Questions