So I try: gm convert PNG_transparency_demonstration_1.png -operator Opacity Multiply 0.5 output.png
But it converts the completely transparent pixels to translucent grey instead of keeping their complete transparency. How to reduce the opacity by half but keep what is already transparent transparent?
Much thanks.
[GraphicsMagick 1.3.22]
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So I try: gm convert PNG_transparency_demonstration_1.png -operator Opacity Multiply 0.5 output.png
But it converts the completely transparent pixels to translucent grey instead of keeping their complete transparency. How to
reduce the opacity by half but keep what is already transparent transparent?
I have not looked at the image yet, but it is important to know that
opacity is the inverse of transparency and the values are stored as
opacity. Try using (untested):
This should cause the multiplication to reduce levels in the correct
direction.
Another useful command is -recolor with a 4x4 or 5x5 matrix, but it
has similar issues. However, -recolor uses double-precision floating
point internally and negative values are allowed.
Perhaps it would be good to add a Transparency operator which operates
on transparency rather than Opacity.
Following example by Bob here http://superuser.com/a/444959/3189 I am having trouble modifying the opacity on a whole image.
The image is here: https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png
I am trying to cut the opacity by 50%.
So I try:
gm convert PNG_transparency_demonstration_1.png -operator Opacity Multiply 0.5 output.png
But it converts the completely transparent pixels to translucent grey instead of keeping their complete transparency. How to reduce the opacity by half but keep what is already transparent transparent?
Much thanks.
[GraphicsMagick 1.3.22]
On Wed, 18 Nov 2015, Erik wrote:
I have not looked at the image yet, but it is important to know that
opacity is the inverse of transparency and the values are stored as
opacity. Try using (untested):
-operator Opacity Negate 0 -operator Opacity Multiply 0.5 -operator Opacity Negate 0
This should cause the multiplication to reduce levels in the correct
direction.
Another useful command is -recolor with a 4x4 or 5x5 matrix, but it
has similar issues. However, -recolor uses double-precision floating
point internally and negative values are allowed.
Perhaps it would be good to add a Transparency operator which operates
on transparency rather than Opacity.
Bob
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Wow, that did the trick (-operator Opacity Negate 0 -operator Opacity Multiply 0.5 -operator Opacity Negate 0). Thank you!