Replace one colour in the image with another, with a tolerance.
Wraps Image.replace_color/2. Two source-colour selection modes:
Threshold — pick all pixels within
:thresholdof:from.:frommay be a hex string ("#ff0000"), a CSS-name string ("misty_rose"or"misty rose"), an integer in 0..255, an RGB three-tuple, or the atom:auto(the average of the top-left 10×10 region of the image is used; this isImage's documented default).Range — pick all pixels with channel values between
:less_thanand:greater_than. When both are set, range mode wins over the threshold mode.
In all modes, matched pixels are replaced with :to (defaults to
"#000000"). When :blend? is true, the replacement blends
smoothly across the boundary rather than hard-cutting.
Summary
Types
@type color() :: String.t() | atom() | non_neg_integer() | [non_neg_integer()]