How can I convert RGB to CMYK and vice versa in python?

后端 未结 7 1217
夕颜
夕颜 2020-12-01 08:13

If I had a RGB decimal such as 255, 165, 0, what could I do to convert this to CMYK?

For example:

>>> red, green, blue = 255, 1         


        
7条回答
  •  心在旅途
    2020-12-01 08:55

    Using a CMYK conversion like the one given in the accepted answer (at the time of this writing) is not accurate for most practical purposes.

    CMYK is based on how four kinds of ink form colors on paper; however, color mixture of inks is considerably complex, more so than the mixture of "lights" used to form colors in the RGB color model.

    As CMYK is useful, above all, when printing images, any conversion to CMYK needs to take the printing condition into account, including what printer and what paper is used for printing. An accurate conversion to CMYK for printing purposes is not trivial and requires calibrating the printer and measuring CMYK patches on a test sheet, among other things.

    There is no meaning for CMYK colors that is as ubiquitous as sRGB is for RGB, as illustrated by the International Color Consortium's page of CMYK characterization data.

    See also my color article on this subject.

提交回复
热议问题