问题
Is there any technology available in a browser (client-side) able to convert sRGB colors to CMYK and vice versa using a specified ICC color profile?
I'm currently using a hidden Java applet for the conversions (Java has a built-in class for this), but I'm trying to find an alternative, since java applets are slow and outdated.
SVG would be ideal if browsers supported ICC colors in SVG, but no-one does. Flash or Silverlight would also be good, but I can't find anything relevant.
回答1:
Am I correct in thinking you want use the ICC profile of the display device?
I am fairly certain there is no facility to determine the display device ICC profile using javascript. At best it may be possible in a third party environment like Flash. The math itself would be no problem.
Of course, this is all really the responsibility of the web browser. Firefox has reasonably good support for colour management. If I'm not mistaken, Microsoft are going to be addressing colour management in IE9.
回答2:
After reading your question, I can't decide if:
a. you're trying to do a soft-proof operation, or
b. you're building a color picker type of app, and you want to provide your users with the names of certain colors (from e.g. pantone or NCS or somesuch) when you display their sRGB-value approximations, or
c. something else entirely.
What is the CMYK space you are concerned with? If you're doing option (a) -- soft proofing -- you can probably fit curves to the LUTs in the CMYK profile, and use them to figure out a 'shortcut' transform that you can then run in the non-ICC-aware javascript runtime you're working in. Most CMYK profiles do their conversion with LUTs, and many use ICC4 NamedColor2 values (which you may know as the value in 'ncl2' ICC tags).
If this is the case, I can point you to some resources on how to do that -- I am doing it myself using SciPy in the python django color-management image-analysis app platform thing I am working on.
If you're doing option (b), and you need color names, you can extract the names you need from your CMYK profile (most likely NamedColor2 values) and build a lookup table, which you can then serialize it to JSON so you can load it in your app. If your app needs to have some knowledge of the display space, you can probably have the user 'calibrate' your app for their display -- feed them some questions that will allow you to calculate the white-point offset (and possibly the RGB XYZ tristimulii) and then maybe create a quickie transform (which could be as simple as one chromatic adaptation transform I am guessing) which you then apply to color values you want to 'color manage' before you display them.
To do the transforms without a CMS system, Bruce Lindbloom's math is a good place to start:
http://www.brucelindbloom.com/
if it's c) I am very curious as to what it is.
is any of that helpful? I can elaborate and/or provide example code, &c, if you supplement your question (I'm doing work in a similar problem-domain, so we could both win on this).
来源:https://stackoverflow.com/questions/4707662/is-there-any-client-side-technology-able-to-convert-srgb-to-cmyk-through-an-icc