Transparent Image

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
JaysonP

Transparent Image

Post by JaysonP »

Short Summary of My Goal: Trying to take a radar image with a black background and make the black background completely transparent (100%) also while making the radar image (colored pixels) somewhat transparent (ie. 50% transparent).

I've been able to easily strip away the black background using the following command

Code: Select all

convert radar.png transparent -black radar-bgclear.png
The next step would be to make the radar image, which was left untouched by the previous command, semi-transparent. I've tried several examples and have came across two distinct problems.


1) Using the following code(s) I was able to get the radar image semi-transparent, however also ended up with a 'darkened' background that was not 100% transparent.

Code: Select all

composite -dissolve 50% clear.png radar.png radar-1.png

Code: Select all

convert radar.png -channel all -fx '0.5' radar-1.png

2) The following got rid of the darkened background problem, but made the entire radar image that remained gray.

Code: Select all

convert radar.png -channel rgb -fx '0.5' radar-1.png

Any ideas as to how this could be accomplished? Thanks!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Transparent Image

Post by snibgo »

convert radar.png -alpha set -transparent black -channel alpha -evaluate multiply 0.5 radar-trans.png
snibgo's IM pages: im.snibgo.com
Post Reply