CMYK To RGB

This algorithm converts CMYK color model to RGB color model.



									class CMYK:
    def __init__(self, c, m, y, k):
        self.C = float(c)
        self.M = float(m)
        self.Y = float(y)
        self.K = float(k)

class RGB:
    def __init__(self, r, g, b):
        self.R = bytes([int(r)])
        self.G = bytes([int(g)])
        self.B = bytes([int(b)])

def CMYKToRGB(cmyk):
    r = (255 * (1 - cmyk.C) * (1 - cmyk.K))
    g = (255 * (1 - cmyk.M) * (1 - cmyk.K))
    b = (255 * (1 - cmyk.Y) * (1 - cmyk.K))

    return RGB(r, g, b)
								


Example

									data = CMYK(0.47, 1, 0.44, 0.39)
value = CMYKToRGB(data)
								


Output

									R: [82]
G: [0]
B: [87]