I have a problem:
Browsers do not support showing images in CMYK mode and the client see some really sharp and different colors in his uploaded image while the colors is alright.
this what i am thinking, now my question is if this solution is right ? and if there is any better way to do the job ? please give me your ideas.
Browsers do not support showing images in CMYK mode
Showing CMYK images correctly wouldn't be possible as it is relative to the output device, and converting for simulated preview would need a locally calibrated and accurate ICC profile (or at least a high quality approximated profile if accuracy is not required).
You could simply convert each CMYK pixel into RGB, however, since RGB has a wider gamut than CMYK you might end up with a very bright looking result.
In my opinion the better approach is to implement a conversion setup at server side when uploading using ImageMagick or similar software which can take into account ICC profiles. This will allow you to keep the original CMYK file for download/print and a converted and approximated RGB version for preview purposes (you could f.ex. allow client to upload their output ICC for accurate preview).
In any case, the formula to convert CMYK data directly to RGB is:
var C, M, Y, K; // initialize with normalized values
var r = 255 * (1 - C) * (1 - K); var g = 255 * (1 - M) * (1 - K); var b = 255 * (1 - Y) * (1 - K);
The alpha channel is set to fully opaque.
©2020 All rights reserved.