How do you create a multi transparent PNG

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
clownpleco
Posts: 6
Joined: 2012-09-24T10:23:12-07:00
Authentication code: 67789

How do you create a multi transparent PNG

Post by clownpleco »

I have 2 pngs. The first is a gray shade infrared satellite image. The second is a gray shade image representing the transparency of each individual pixel. Basically I want to make the colder clouds less transparent than the warmer clouds.

1) What should the gray shade values be set to in the transparency image.
2) Is there a convert and or compose command to get the desired results.

Thanks

Rick
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do you create a multi transparent PNG

Post by fmw42 »

Grayscale values typically are 0 to 255 if 8-bit image and 0 to 65535 for 16-bit image. But if you want more or less effect you can use -level or +level to adjust the grayscale values

To put the grayscale image as a transparency layer use:

convert baseimage transparencyimage -alpha off -compose copy_opacity -composite result.png

If the result is showing the opposite of what you want transparent, then use -negate on the transparency image to reverse the polarity.

see
http://www.imagemagick.org/Usage/color_mods/#levels
http://www.imagemagick.org/Usage/compose/#compose
http://www.imagemagick.org/Usage/compose/#copyopacity
Post Reply