1

I have array of square regions which covered with 5 colors CMYK +white. There is no overlap of colors. When you looking at those squares from distance - each square become 1 pixel. I need to convert each square to closest RGB equivalent and create an image. I can get percentage of each color, in JSON file. Can use javascript on client side or on server side.

Example of input:

[
    {c:20,m:10,y:15,k:20,w:35}, // Percent of area covered by color
    {c:50,m:0,y:0,k:0,w:50},
    ...
]

Expected output:

[
    {r:?,g:?,b:?},
    {r:?,g:?,b:?},
    ...
]
Oleg Imanilov
  • 2,591
  • 1
  • 13
  • 26
  • It seems like you're trying to convert CMYK to RGB, which [has been asked and answered before](http://stackoverflow.com/q/37641733/215552). – Heretic Monkey Jul 14 '16 at 20:03
  • Not exactly. I have percentage of CMYKW - I don't know how to convert 30% white 20% Black 50% Cyan - into CMYK - to convert it into RGB – Oleg Imanilov Jul 14 '16 at 21:14
  • I've never heard of having both K and W, considering K is the amount of black and I would think W would just be the opposite. Don't know what to tell you. I'd do more digging on the internet. For instance, I found [this table](https://patentimages.storage.googleapis.com/US7583421B2/US07583421-20090901-D00006.png) within a patent application, but I have no clue if it's accurate or really anything about it. – Heretic Monkey Jul 14 '16 at 21:49
  • Usually you get CMYK for mixed color - so K is portion of black, but in my case it is not mixed color - so black and white is part of mixture which must be calculated into K. Also I don't know how to calculate CMY parts. For example does 50% cyan and 50% white - means C = 0.5 or C = 1 ? – Oleg Imanilov Jul 14 '16 at 22:08
  • 1
    it sounds like each square is just pure cyan magenta yellow black, so those 4 colors directly in rgb are just cyan:rgb(0,255,255), yellow:rgb(255,255,0), magenta: rgb(255,0,255), black: rgb(0,0,0) – chiliNUT Jul 15 '16 at 00:45

0 Answers0