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 & InitPython
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.
- This section has 10 entries; this is one of them.
- See the full section index: Color
Other entries in this section
- app.CreateRGBColor(Red, Green, Blue)Builds an RGB color, each component 0-255. Screen work, web images, so
- app.CreateCMYKColor(Cyan, Magenta, Yellow, Black)Builds a CMYK color, each component 0-100. If the job ends up on press
- app.CreateGrayColor(Value) / CreateHLSColor(H, L, S) / CreateHSBColor(H, S, B)Three more ways to build a color: gray (0-255), HLS, HSB. For lighter
- color.RGBAssign(R, G, B) / color.CMYKAssign(C, M, Y, K)Changes the components of an existing color in place. No new object —
- color.HLSAssign(H, L, S) / color.HSBAssign(H, S, B) / color.GrayAssign(V)In-place recolor via HLS, HSB or gray. To generate a scale of one hue
- color.HexValue / color.RGBValueHexValue is a #RRGGBB string you can match against the swatch in the d
- color.BlendWith(OtherColor, Weight)Mixes two colors into an in-between shade. Automatic palettes and tona
- color.CopyAssign(SourceColor) / color.IsSame(OtherColor)Copies one color's values onto another (without changing object refere