I am currently building an online APP which allows users to pick a color for text from a usual javascript color picker. I want to convert the returned value to CMYK and I know there is not one simple run-of-the-mill method to achieve this, given there are ICC profiles and all that.
I still want to achieve a relatively useful conversion the way “most” users know from Photoshop. The profiles I want to use are “AdobeRGB” for the RGB colorspace, and “Coated Fogra39” for the CMYK colorspace.
What I want to know is, if there is any method to convert single color values from one colorspace to the other, by utilizing these two ICC profiles (which I have downloaded). There are methods to convert entire images with ImageMagick, but I am dying trying to find a way to just calculate from one color value to the other.
I am also inclined to use other means of achieving this goal if there are any ideas out there.
Thanks.
3
Answers
You could use Imagick::setImageColorSpace
Here’s a tutorial
Also i must warn you cmyk profile is for printing not for screening they will be differences and you can’t calculate the same as rgb ( rgb misses the black thing ) an example for black ( everyone know’s this color )
RGB Black : 0, 0, 0,
CMYK Black: 100%;
But they 100% key doesn’t work the same on some printers you only need 100% on others like the one that i use a roland sp 540i i make a combination of colors to produce different types of black based on what i need because 100%key will not produce the black that everyone knows and you can test it even in photoshop / corel draw to see a difference if your screen helps u.
Other examples:
black is available as Pantone® Process Black C (coated), U,
(Uncoated) and M (Matt).
comprised [typically] of between 20%-80% yellow.
comprised [typically] of between 20%-80% magenta.
So you see CMYK is very different from rgb space because is used for printing and that means you will have trouble if you don’t know how it works.
Update: ICC Profiles are for monitors not for printing ..
You can try to create a Photoshop image that consists of a series of gradients that emulate a subset of all RGB colors and then save this as a CMYK (say uncompressed TIFF so you can use the image like a lookup table). Read the color values and based on those create a set of equations that can extrapolate the destination CMYK from a lookup in this image, although that is a lot of effort, tried once and abandoned, somewhat complex… Or, give the user a reduced set of combinations and store those in a table, like all the #000 — #fff combinations, if that is acceptable for you.
RGB — CMYK conversion is far from simple, that’s why Adobe progs cost money…
To just answer the question in your Title:
Convert RBG to CMYK with use of ICC profile in PHP
You can use the commandline via a
system()
call:This will work on Linux with imagemagick installed