Increasing transparency using a grayscale mask
Posted: 2010-07-21T13:17:31-07:00
Hi everyone,
after some 6 hours of fiddling around and searching the WebI I am staring to get a little desperate... Somehow I just seem to be incapable of understanding home IM handles transparency (as opposed to, say, GIMP). Hence I finally decided to just ask for help on the following task:
I hava a (png) image containing semi-transparent pixels. Furthermore, I am generating on-the-fly a grayscale image (using a draw and a blur operation). Now I would like to use the grayscale image as a mask for modifying the png image's transparency so that image pixels conciding with white mask pixels retain their current transparency value while those being masked with black pixels become fully transparent. In other words, I would like to multiply the png image's opacity values with the mask's intensity values.
Any hints how to achieve the desired effect? (I am using PerlMagick, but since I am interested in the general procedure I am posting here rather than in the PerlMagick forum).
Thanks in advance for any help --
tcrass
after some 6 hours of fiddling around and searching the WebI I am staring to get a little desperate... Somehow I just seem to be incapable of understanding home IM handles transparency (as opposed to, say, GIMP). Hence I finally decided to just ask for help on the following task:
I hava a (png) image containing semi-transparent pixels. Furthermore, I am generating on-the-fly a grayscale image (using a draw and a blur operation). Now I would like to use the grayscale image as a mask for modifying the png image's transparency so that image pixels conciding with white mask pixels retain their current transparency value while those being masked with black pixels become fully transparent. In other words, I would like to multiply the png image's opacity values with the mask's intensity values.
Any hints how to achieve the desired effect? (I am using PerlMagick, but since I am interested in the general procedure I am posting here rather than in the PerlMagick forum).
Thanks in advance for any help --
tcrass