Using ImageMagick to remove all color except black in an image?

后端 未结 3 1800
Happy的楠姐
Happy的楠姐 2020-12-14 12:14

The situation is : I have many images of documents from scanning. I want to keep the document\'s main content - which is printed in color black (a small range of colors arou

3条回答
  •  暖寄归人
    2020-12-14 12:56

    To match all colors except black you can use +opaque "#000000".

    In order to include a little range around #000000 you can try different percentages with the fuzz operator:

    convert input.png -fill white -fuzz 10% +opaque "#000000" result.png
    

    Tested with ImageMagick 6.6.0-1 on Windows

提交回复
热议问题