Page 1 of 1

Simulating CMYK colors in RGB

Posted: 2011-06-23T18:50:27-07:00
by semiadam
Hello world!
I want to simulate CMYK colors in RGB format, so user will have an idea how her uploaded file will be printed. It means that if someone uploads a sharp green RGB(0,255,0) I want to show something like RGB(105,180,69) but it should be shown in RGB because some browsers doesn't support CMYK. In Photoshop you can do this by changing color space to CMYK and then change it back RGB. I tried different ways in ImageMagick, some of them worked partially but still could not find a solid way for doing this. Any idea?

Re: Simulating CMYK colors in RGB

Posted: 2011-06-23T18:51:26-07:00
by fmw42
sorry your comment is a bit confusing. you only talk about RGB colors where does the CMYK come in? If you can clarify perhaps we can help.

do you want something like this:
convert -size 100x100 xc:"cmyk(255,0,255,0)" -colorspace RGB test1.png


in the mean-time see the Interactive Color Convert at http://www.imagemagick.org/script/color.php


P.S. What version of IM are you using and on what platform?

Re: Simulating CMYK colors in RGB

Posted: 2011-06-23T20:14:34-07:00
by semiadam
Hi thanks for your quick reply
Both my input and output files are in RGB, but I want the output to "look like" it's CMYK (in which colors are usually more dull than RGB). So if I have a plain RGB(0,255,0) file, I want the output to be plain RGB(105,180,69). You can gain this in Photoshop by converting your RGB to CMYK, and then converting it back to RGB (or save it for web). I want to the same thing in IM.

I use ImageMagick 6.6.5-5 Q16 on Fedora rel. 14.

Re: Simulating CMYK colors in RGB

Posted: 2011-06-23T20:33:44-07:00
by fmw42
Seems like a strange thing to do and PS is not working reversibly which is odd, since if you convert rgb to cmyk and back again you should be getting back the same rgb values.

I tried your experiment in PS and it does not make sense to me as when you convert to cmyk it should look totally different in fact it should be magenta and not green. So I have no idea what PS is doing. Also you have to consider what colorspace profile is being used by PS.

This seems to do something visually like what you want. You will have to play with profiles to get exactly what you want.

compare the following two images:

convert -size 100x100 xc:"RGB(0,255,0)" test1.png
convert -size 100x100 xc:"RGB(0,255,0)" -colorspace cmyk -profile Profiles/CMYK.icc -profile Profiles/AdobeRGB1998.icc test2.png