I have two 7x7 pixel PNG files. One contains a red triangle with the other half of the image being fully transparent white; the other image is totally opaque. I'm trying to create a 47x7 PNG which has the one image at the left and the other at the right with a similarly transparent white background. I've tried saying:
convert -size 47x7 xc:transparent Triangle.png -geometry +40+0 -composite 1.png -composite New.png
This gives me a 47x7 PNG with a transparent background with the image from 1.png on the left and the image from Triangle.png on the right. However, the transparent region from Triangle.png shows up in solid black. I've tried playing with the -alpha option (and tried reading lots of similar examples in the docs) but can't get it to copy the transparency through.
Any help much appreciated!
Merging transparency with a png
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Merging transparency with a png
try
convert -size 47x7 xc:none -gravity west Triangle.png -composite -gravity east 1.png -composite New.png
or
convert Triangle.png -size 33x7 xc:none 1.png +append New.png
If those don't work, then provide links to your two input images so we can see if they have any problems.
convert -size 47x7 xc:none -gravity west Triangle.png -composite -gravity east 1.png -composite New.png
or
convert Triangle.png -size 33x7 xc:none 1.png +append New.png
If those don't work, then provide links to your two input images so we can see if they have any problems.
Re: Merging transparency with a png
Afraid that both of those actually put Triangle.png and 1.png the other way around and the transparency from Triangle.png still gets turned to black.
I've uploaded http://romulus.metastack.com/files/magick.zip which contains the two source files Triangle.png and 1.png, the result I'm getting with my command in New.png and also Required.png which is what I'm trying to get!
I've uploaded http://romulus.metastack.com/files/magick.zip which contains the two source files Triangle.png and 1.png, the result I'm getting with my command in New.png and also Required.png which is what I'm trying to get!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Merging transparency with a png
These two commands work perfectly for me on IM 6.6.4.6 Q16 Mac OSX Tiger. No black showing from the Triangle.png image. Note I switched the images or the gravity settings to reverse the image order to get what you wanted.
convert -size 47x7 xc:none -gravity east Triangle.png -composite -gravity west 1.png -composite New1.png
convert 1.png -size 33x7 xc:none Triangle.png +append New2.png
What version of IM are you using? Perhaps you need to upgrade.
convert -size 47x7 xc:none -gravity east Triangle.png -composite -gravity west 1.png -composite New1.png
convert 1.png -size 33x7 xc:none Triangle.png +append New2.png
What version of IM are you using? Perhaps you need to upgrade.
Re: Merging transparency with a png

Thanks for the help!