Hi,
I've searched the web and documentation at length looking for an answer to this, but I haven't been able to find an answer that fits exactly.
I'm wondering if it is possible with 7.0.4-0 Q16 x64 (or any other version of IM) to set a specific color to a percentage of transparent (or opaque, I suppose)? This would be so that I could do a gradient fade to transparent at the same time it fades in color.
Imagine an eps with solid black lines and a white background. I'm converting them to png's where white needs to be fully transparent and black fully opaque. No problem, except -
Now imagine that some of these images have a round gradient in them somewhere that fades from black to white (looks like a 3D ball.) Can I set the various intermediate colors in the gradient to percentages of transparent? Something like this (which I know isn't valid), for example?
-transparent #cccccc 50% -transparent #fefefe 10% etc.
Or is there a more simple or direct way to do it that I've totally missed?
Thanks!
cfredman
Set a color % transparent?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Set a color % transparent?
You can clone the image and copy the opacity. Then any pixels that were black will become transparent, white will remain opaque, 25% gray will be 25% opaque, etc.
Code: Select all
magick in.png ( +clone ) -compose CopyOpacity -composite out.png
snibgo's IM pages: im.snibgo.com
Re: Set a color % transparent?
Sweet! I will give that a try.
Thanks!
Thanks!
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Set a color % transparent?
Sorry, I've just noticed: "white needs to be fully transparent and black fully opaque". So you'll need to negate:
Code: Select all
magick in.png ( +clone -negate ) -compose CopyOpacity -composite out.png
snibgo's IM pages: im.snibgo.com