Search code examples
imagemagickpngimagemagick-convertalpha-transparency

convert pixel alpha channel when alpha > 90% using imagemagick


I need to convert existing png 2 areas files : one area is transparent and the other is red or blue opaque (one sample here : http://urlz.fr/31t2). I want to keep the first area tranparent and to convert opaque area to 30 or 50% of opacity. I'm desperatly looking for a solution using Imagemagick, as a radio engineer i'm not comfortable with the IM ressources ... I'm only able to convert the whole image to X% of opacity (convert input.png -alpha set -channel A -evaluate set 50% output.png )but that's not what i am looking for !


Solution

  • Your question is quite hard to understand, but I think you want this:

    convert image.png -channel A -fx "u>0.9?0.3:u" result.png
    

    Wherever the alpha is more than 0.9, it will be set to 0.3, otherwise it will be untouched.

    enter image description here