Converting image colors

Converting images

Convert image from one scheme to another

Using getinverse() it's possible to convert an image from one colorscheme to another.

convert_to_scheme(cscheme, img) returns a new image in which each pixel from the provided image is mapped to its closest matching color in the provided scheme.

using FileIO
# image created in the ColorSchemes documentation
img = load("ColorSchemeTools/docs/src/assets/figures/heatmap1.png")

"heatmap 1"

Here, the original image is converted to use the GnBu_9 scheme.

img1 = save("/tmp/t.png", convert_to_scheme(ColorSchemes.GnBu_9, img))

"heatmap converted"

convert_to_scheme(cscheme, img)

Converts img from its current color values to use only the colors defined in cscheme.

image = nonTransparentImg
convert_to_scheme(ColorSchemes.leonardo, image)
convert_to_scheme(ColorSchemes.Paired_12, image)
source