55 | | if r == g == b : |
56 | | black += 255 - r |
57 | | else : |
58 | | cyan += 255 - r |
59 | | magenta += 255 - g |
60 | | yellow += 255 - b |
61 | | return { "C" : 100.0 * (cyan / 255.0) / nbpix, |
62 | | "M" : 100.0 * (magenta / 255.0) / nbpix, |
63 | | "Y" : 100.0 * (yellow / 255.0) / nbpix, |
64 | | "K" : 100.0 * (black / 255.0) / nbpix, |
| 55 | pixblack = 255 - max(r, g, b) |
| 56 | black += pixblack |
| 57 | cyan += 255 - r - pixblack |
| 58 | magenta += 255 - g - pixblack |
| 59 | yellow += 255 - b - pixblack |
| 60 | |
| 61 | frac = 100.0 / nbpix |
| 62 | return { "C" : frac * (cyan / 255.0), |
| 63 | "M" : frac * (magenta / 255.0), |
| 64 | "Y" : frac * (yellow / 255.0), |
| 65 | "K" : frac * (black / 255.0), |