Python | CMY and CMYK Color Models
Cyan, magenta and yellow are the secondary colors of light and the primary colors of pigments. This means, if white light is shined on a surface coated with cyan pigment, no red light is reflected from it. Cyan subtracts red light from white light. Unlike the RGB color model, CMY is subtractive, meaning higher values are associated with darker colors rather than lighter ones.
Devices that deploy pigments to color paper or other surfaces use the CMY color model, e.g. printers and copiers. The conversion from RGB to CKY is a simple operation, as is illustrated in the Python program below. It is important that all color values be normalized to [0, 1] before converting.
C = 1 - R M = 1 - G Y = 1 - B
Below is the code to convert RGB to CMY color model.
(1.0, 0.33725490196078434, 0.6627450980392157)
According to the color wheel shown above, equal amounts of cyan, magenta, and yellow should produce black. However, in real life, combining these pigments produces a muddy-colored black. To produce pure black, which is quite commonly used while printing, we add a fourth color — black, to the pigment mixture. This is called four-color printing. The addition of black in this model results in it being referred to as the CMYK color model.