Merging two image with transparency

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
manpaint
Posts: 4
Joined: 2018-06-13T11:15:31-07:00
Authentication code: 1152

Merging two image with transparency

Post by manpaint » 2018-06-13T11:34:57-07:00

ImageMagick version: ImageMagick-7.0.6-Q16)
Operating System: Windows 7 (64 bits)

Hi, I am trying since two hours now to merge two image that contain transparency (and have the same size) together, here's what I tried so far (as individual commands):

Code: Select all

convert bg.png  2.png -gravity center -composite result.png
convert bg.png bg2.png -gravity center -composite result.png
convert bg.png null: *.png -gravity center -layers composite result%03d.png
composite -geometry  +0+0 bg.png bg2.png result.png
-composite bg.png bg2.png -gravity center -composite result.png
convert bg.png bg2.png -flatten  result.png
composite bg.png bg2.png result.png
convert *bg.png *bg2.png -background none -flatten out.png
Here's what I'm trying to do (random exemple with an Rpg Maker charset; but you get the idea):
Image

I obviously put both images in the same folder and execute the command here but most of the time it just return the error 'bg2.png is not a valid parameters'. I used ImageMagick before to do simple image flipping via cmd and it worked just fine but now, everything I tried so far just dosen't work. Do anyone here have an idea of what is wrong/is the right commad to do)?

snibgo
Posts: 10932
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Merging two image with transparency

Post by snibgo » 2018-06-13T11:50:08-07:00

ImageMagick does not make the error message "bg2.png is not a valid parameter". That error message comes from a Microsoft Windows program called convert.exe.

You can put your IM directory at the front of your system path, or always call convert with an explicit path, or rename it something like imconvert.exe.
snibgo's IM pages: im.snibgo.com

manpaint
Posts: 4
Joined: 2018-06-13T11:15:31-07:00
Authentication code: 1152

Re: Merging two image with transparency

Post by manpaint » 2018-06-13T12:03:18-07:00

snibgo wrote:
2018-06-13T11:50:08-07:00
ImageMagick does not make the error message "bg2.png is not a valid parameter". That error message comes from a Microsoft Windows program called convet.exe.

You can put your IM directory at the front of your system path, or always call convert with an explicit path, or rename it something like imconvert.exe.
Thanks! It now works very well.

Post Reply