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

后端 未结 7 1213
夕颜
夕颜 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:58

    For this conversion to be useful, you need a color management system, with profiles describing the RGB system and the CMYK system being converted.

    http://en.wikipedia.org/wiki/CMYK_color_model#Conversion

    Here is a discussion of how to solve this problem using ICC profiles:

    How can one perform color transforms with ICC profiles on a set of arbitrary pixel values (not on an image data structure)?

    Here is a link to pyCMS, which uses ICC color profiles to do the conversion:

    http://www.cazabon.com/pyCMS/

提交回复
热议问题