Page 1 of 1

Opacity() method removing alpha from all pixels

Posted: 2012-11-12T22:18:21-07:00
by jonoomph
Using the C++ api, it seems like the opacity() method applies the same alpha value to all pixels in the image. If I use a completely opaque image, I can fade the entire image correctly. However, if the source image already contains alpha, such as a alpha gradient, or transparent corners, etc... the opacity() method seems to replace the alpha values... and thus removes the original transparency from the source image.

What is the best way to increase (or decrease) the existing alpha values in an image... without replacing them all with a single value?

For example, in the popular vector graphics app Inkscape, if you have a rectangle which contains an alpha gradient... you can still apply an opacity to the entire shape, which preservers the alpha gradient... it just increases the alpha or decreases the alpha values in the shape.

Thanks!
-Jonathan

Re: Opacity() method removing alpha from all pixels

Posted: 2012-11-12T23:14:29-07:00
by jonoomph
I found that the quantumOperator(Magick::OpacityChannel, Magick::MultiplyEvaluateOperator, alpha_value) method seems to do the trick, and simply multiplies the new alpha percentage to all values in the alpha channel, and works great.

Thanks!
-Jonathan