使用阈值在ImageMagick中将任何白色像素设置为透明?

Ima*_*geQ 7 imagemagick

使用ImageMagick,我想找到任何白色的像素并使它们透明.我认为关键是-threshold,但我无法弄清楚如何使用-threshold将白色像素更改为透明.任何建议最受赞赏.

Bra*_*rad 11

convert input.png -fuzz 10% -transparent white output.png
Run Code Online (Sandbox Code Playgroud)

请注意,参数的顺序很重要 - -fuzz必须先来-transparent.


Mec*_*are 4

像这样的东西会起作用吗?

convert input.jpg -fuzz 5% -fill to_color -opaque from_color output.jpg
Run Code Online (Sandbox Code Playgroud)