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=1max(R,G,B)C={0 if K=11RK1K otherwise M={0 if K=11GK1K otherwise Y={0 if K=11BK1K 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=(1C)(1K)G=(1M)(1K)B=(1Y)(1K)\begin{align*} R &= (1 - C) \cdot (1 - K) \\ G &= (1 - M) \cdot (1 - K) \\ B &= (1 - Y) \cdot (1 - K) \end{align*}