Generating CMYK text

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
semiadam
Posts: 6
Joined: 2011-06-23T18:39:19-07:00
Authentication code: 8675308

Generating CMYK text

Post by semiadam »

I am trying to generate CMYK text with accurate values for C,M,Y,K channels to be used in a printing project. However after using this command:

Code: Select all

 convert -fill "cmyk(20%,30%,40%,10%)" -pointsize 100 -colorspace cmyk label:TEST 1.jpg
when I open the file in Photoshop the CMYK values I see are: (0,25,47,52). I'm thinking maybe IM converts CMYK values to RGB when generating text and then converts it back to CMYK after -colorspace switch and since CMYK<->RGB is not a 1-to-1 mapping this shift happens (not sure though). Does anyone know how I can generate and output text (and other elements) while keeping the exact CMYK values?

Thanks.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Generating CMYK text

Post by fmw42 »

convert -fill "cmyk(20%,30%,40%,10%)" -pointsize 100 -colorspace cmyk label:TEST 1.jpg
try changing the order of your options so you create the label image before changing colorspace

convert -fill "cmyk(20%,30%,40%,10%)" -pointsize 100 label:TEST -colorspace cmyk CMYK.icc 1.jpg
I'm thinking maybe IM converts CMYK values to RGB when generating text and then converts it back to CMYK after -colorspace switch
My understanding is that this is a correct assumption. You probably would be better using a profile than -colorspace. Something like:

convert -fill "cmyk(20%,30%,40%,10%)" -pointsize 100 label:TEST -profile sRGB.icc -profile CMYK.icc 1.jpg

(or try USWebCoatedSWOP.icc in place of CMYK.icc)

But I cannot guarantee that will work perfectly either. I do not know how IM converts cmyk to sRGB in the fill command. So that may be different than either -colorspace cmyk or with profiles as there are many profiles for both sRGB and CMYK, I suspect.
semiadam
Posts: 6
Joined: 2011-06-23T18:39:19-07:00
Authentication code: 8675308

Re: Generating CMYK text

Post by semiadam »

Unfortunately it didn't work.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Generating CMYK text

Post by fmw42 »

fmw42 wrote:convert -fill "cmyk(20%,30%,40%,10%)" -pointsize 100 label:TEST -colorspace cmyk CMYK.icc 1.jpg
Oops. I made an error here and left in CMYK.icc. It should have been

Code: Select all

convert -fill "cmyk(20%,30%,40%,10%)" -pointsize 100 label:TEST -colorspace cmyk 1.jpg
I don't know if that will make an difference or not.

If this or the command using profiles does not work, then I am at a loss to know what else to try. Sorry.
Post Reply