def RGB_to_CMYK(r, g, b, gcr=1.0):
    """
    take r,g,b float values (0.0 to 1.0),
    invert to get c,m,y,
    apply GCR (0.0 to 1.0, 0 means no GCR = CMY separation),
    return c,m,y,k as integers (percent values)

    GCR see http://en.wikipedia.org/wiki/Grey_component_replacement
    """
    c, m, y = (1.0 - (float(x)/2) for x in (g+b, r+b, r+g))
    k = min(c, m, y) * gcr
    c, m, y = c-k, m-k, y-k
    return [int(round(x*100)) for x in (c, m, y, k)]