Home/ Reference/ Color

color.ConvertToCMYK() / ConvertToRGB() / ConvertToGray() / ConvertToHLS()

Explicit color model conversion. It mutates the object rather than returning a new one. Converting to CMYK first is what makes reading CMYK channels meaningful.

Signature

color.ConvertToCMYK() / ConvertToRGB() / ConvertToGray() / ConvertToHLS()

Notes

Explicit color model conversion. It mutates the object rather than returning a new one. Converting to CMYK first is what makes reading CMYK channels meaningful.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
c = app.CreateRGBColor(0, 133, 205)

c.ConvertToCMYK()                                   # convert to CMYK in place
print("Is CMYK after conversion: ", c.IsCMYK)
print("C/M/Y/K:", c.CMYKCyan, c.CMYKMagenta,
      c.CMYKYellow, c.CMYKBlack)

c.ConvertToRGB()                                    # and back to RGB
print("Back to RGB: ", c.RGBRed, c.RGBGreen, c.RGBBlue)

About this section: Color

Color — RGB, CMYK and hex color values.

Other entries in this section