I have a colorful image that has alot of existing transparent background, but also a few blocks of hot pink rgb(255,0,255)
color I want to additionally become transparent.
I'm doing so like this:
convert 0001.png -fuzz 15% -fill transparent -transparent "rgb(255,0,255)" result.png
The problem is, because the original image was anti-aliased, there is still a hot pink halo, where it's not matching e.g. rgba(255,0,255, 50 )
and other partially-transparent values, unless I turn up the -fuzz
way too high.
So I figured I'd solve the problem like this:
convert 0001.png -fuzz 15% -fill transparent
-transparent "rgba(255,0,255,0)"
-transparent "rgba(255,0,255,64)"
-transparent "rgba(255,0,255,128)"
-transparent "rgba(255,0,255,192)"
-transparent "rgba(255,0,255,255)"
result.png
...but the additional calls to -transparent
with varying levels of opacity don't seem to be having any additional effect.
It is almost as if calls to -transparent truncate my rgba(255,0,255,128)
to rgb(255,0,255)
before doing match (although -fuzz
still looks at opacity, it seems to always do so starting from 255, not from the opacity I pass into -transparent
).
How can I replace all examples of the color RGB(255,0,255)
, regardless of the pixel's pre-existing alpha?
This is the image I'm using:
This is what I'm being left with and I want to remove: (magnified and given white background for ease of seeing)
-transparent
is only getting rid of the fully opaque pink, not the semi-opaque pink, when the opacity falls below the '-fuzz' threshold, but turning up the fuzz makes-transparent
also remove colors that aren't pink.