Skip to main content

RGB and CMYK

Red, Green, Blue ⇄ Cyan, Magenta, Yellow, Black

This conversion is purely mathematical. Support for color spaces with regards to CMYK is a long-term goal.

RGB to CMYK​

K=1−max(R,G,B)C={0 if K=11−R−K1−K otherwise M={0 if K=11−G−K1−K otherwise Y={0 if K=11−B−K1−K otherwise \begin{align*} K &= 1 - max(R,G,B)\\ C &= \begin{cases} 0 & \text{ if } K=1 \\ \frac{1 - R - K}{1 - K} & \text{ otherwise } \end{cases} \\ M &= \begin{cases} 0 & \text{ if } K=1 \\ \frac{1 - G - K}{1 - K} & \text{ otherwise } \end{cases} \\ Y &= \begin{cases} 0 & \text{ if } K=1 \\ \frac{1 - B - K}{1 - K} & \text{ otherwise } \end{cases} \\ \end{align*}

CMYK to RGB​

R=(1−C)⋅(1−K)G=(1−M)⋅(1−K)B=(1−Y)⋅(1−K)\begin{align*} R &= (1 - C) \cdot (1 - K) \\ G &= (1 - M) \cdot (1 - K) \\ B &= (1 - Y) \cdot (1 - K) \end{align*}