GraphicsMagick replace all colors (except yellow) to transparent

随声附和 提交于 2019-12-25 06:57:16

问题


Tried to replace all colors except yellow (with some -fuzz) to transparent without result. Didn't find anything in documentation maybe someone can help me.

Thank you.

As I know in ImageMagic there is +opaque, but I can't use this library


回答1:


This should do what you want. It makes the yellow pixels transparent and then inverts the alpha channel.

gm convert input.png +matte -matte -fuzz 5% -transparent yellow -operator matte negate 1 output.png

The "+matte" removes any existing transparency that might be in the input.png, then "-matte" adds an opaque alpha channel.

Tested with GraphicsMagick-1.3.20.



来源:https://stackoverflow.com/questions/27178320/graphicsmagick-replace-all-colors-except-yellow-to-transparent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!