ImageQ
ImageQ

Reputation: 81

Set any white pixels to transparent in ImageMagick using a threshold?

Using ImageMagick, I want to find any pixels that are white and make them transparent. I'm thinking the key is -threshold but I can't work out how to change a white pixel to transparent using -threshold. Any suggestions most appreciated.

Upvotes: 8

Views: 4627

Answers (2)

Brad
Brad

Reputation: 1017

convert input.png -fuzz 10% -transparent white output.png

Note that the order of the arguments is important - -fuzz must come before -transparent.

Upvotes: 15

QuantumRob
QuantumRob

Reputation: 2924

Would something like this work?

convert input.jpg -fuzz 5% -fill to_color -opaque from_color output.jpg

Upvotes: 4

Related Questions