Skip to main content

Replace color (:replace_color)

Declaration​

img = img:replace_color(from_color, to_color[, similarity])

Parameters​

  • from_color
    Integer. Original color
  • to_color
    Integer. Color to replace with
  • similarity
    Integer, optional. 0~100. Default 100

Returns​

  • img
    Image object. Returns the image object itself after replacement

Description​

Replace a color (or similar colors) on the image with another color
Mutates the image in-place
Performance: no data copy during operation

Example​

Replace QR background color