Quantcast
Channel: User Kamil Maciorowski - Super User
Viewing all articles
Browse latest Browse all 837

Answer by Kamil Maciorowski for Replacing a color using -transparency regardless of existing pixel opacity, using ImageMagick

$
0
0

...but the additional calls to -transparent with varying levels of opacity don't seem to be having any additional effect.

In rgba(R,G,B,A) the A is from 0 (fully transparent) to 1 (fully opaque), not from 0 to 255. Your attempt can be fixed like this:

convert 0001.png -fuzz 15% -fill transparent \-transparent "rgba(255,0,255,0)" \-transparent "rgba(255,0,255,0.25)" \-transparent "rgba(255,0,255,0.5)" \-transparent "rgba(255,0,255,0.75)" \-transparent "rgba(255,0,255,1)" \result.png

This is the result:

result, fuzz 15%

I don't know if it's the best solution. At least it shows your idea with multiple -transparent wasn't bad, you just got the range of opacity wrong.

The above result is not perfect, there are some pinkish remnants where pink has been blended with other (opaque) colors. With -fuzz 35% it looks better in this aspect:

result, fuzz 35%

But the edges lose their softness.


Viewing all articles
Browse latest Browse all 837

Trending Articles