RGB 0,0,0 Black to CMYK 'Rich Black' 75,68,67,90

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Post Reply
boognish100
Posts: 14
Joined: 2016-09-14T00:19:26-07:00
Authentication code: 1151

RGB 0,0,0 Black to CMYK 'Rich Black' 75,68,67,90

Post by boognish100 » 2016-10-26T23:48:39-07:00

Hi,

In Photoshop, RGB black (0,0,0) converts as CMYK Rich Black 75,68,67,90. However when I convert a RGB image containing 0,0,0 Black with Imagemagick it converts it to CMYK 0,0,0,100 (which prints as a dull, dark grey rather than black). In photoshop, CMYK 0,0,0,100 converts to RGB 35,31,32.

current code...
exec("convert -colorspace cmyk -density 400 image.png image.pdf", $array);

So my question is, is there a way I can make ImageMagick convert RGB images to CMYK images with the same method photoshop does (UCR) to achieve 'Rich Black' 75,68,67,90 rather than plain black 0,0,0,100?

snibgo
Posts: 9379
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: RGB 0,0,0 Black to CMYK 'Rich Black' 75,68,67,90

Post by snibgo » 2016-10-27T00:02:27-07:00

What profiles are you using in Photoshop? If you use the same profiles in IM (not "-colorspace cmyk", which is merely an arithmetic conversion), you should get the same results (more or less).

EDIT: Your command is bad. You should read the input, process it, and write the output. In that order.
snibgo's IM pages: im.snibgo.com

boognish100
Posts: 14
Joined: 2016-09-14T00:19:26-07:00
Authentication code: 1151

Re: RGB 0,0,0 Black to CMYK 'Rich Black' 75,68,67,90

Post by boognish100 » 2016-10-27T00:31:55-07:00

I checked the cmyk profile in photoshop colour settings, and downloaded it from adobe (USWebCoatedSWOP.icc) and placed in the same server folder as the script. Though the pdf comes out as rgb not cmyk. What am I doing incorrectly?

exec("convert image.png -profile USWebCoatedSWOP.icc -density 400 image.pdf", $array);

snibgo
Posts: 9379
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: RGB 0,0,0 Black to CMYK 'Rich Black' 75,68,67,90

Post by snibgo » 2016-10-27T00:42:33-07:00

Does image.png have an embedded profile? If so, then that should work. But I suspect it doesn't, so you are merely assigning a profile, instead of converting to a new profile. That is, you are merely setting metadata rather than calculating new pixel values.

I suggest you start with something simple, without the complications of PDF.

Code: Select all

convert xc:black -profile sRGB.icc -profile USWebCoatedSWOP.icc txt:
My result:

Code: Select all

# ImageMagick pixel enumeration: 1,1,65535,cmyk
0,0: (47564,44272,43958,56135)  #B9CCACF0ABB6DB47  cmyk(73%,68%,67%,86%)
This is close to your required output. In addition to using the same profiles, the other variables are: black point compensation, intent, and dot gain. I don't think IM has the equivalent of dot gain, so you'll only get the same result if this is "off" in PS.
snibgo's IM pages: im.snibgo.com

boognish100
Posts: 14
Joined: 2016-09-14T00:19:26-07:00
Authentication code: 1151

Re: RGB 0,0,0 Black to CMYK 'Rich Black' 75,68,67,90

Post by boognish100 » 2016-10-27T00:58:57-07:00

Bingo ... That works!! Thanks so much again for your help snibgo :)

Post Reply