CMYK PDF to PDF color change

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
Nik
Posts: 37
Joined: 2009-09-16T03:54:58-07:00
Authentication code: 8675309

CMYK PDF to PDF color change

Post by Nik »

Hi All,

I'm and infrequent user of IM and most of the times I just use it to make thumbnails but my current project is to make a lowres CMYK PDF but I'm having problems with the output colour.

In its simplest form the command is:

convert input.pdf output.pdf

which gives me incorrect colour i.e. A red that has a CMYK value of:

0% cyan
100% Magenta
100% Yellow
0% black

is being converted too:

0% cyan
77% Magenta
83% Yellow
0% black

Could this be down to GhostScript? my full command is this:

Code: Select all

/usr/bin/convert -colorspace CMYK -profile "$iccProfilePath" -units PixelsPerInch -define pdf:use-trimbox=true -density 150 "$image1" -resize 2480x2480 -colorspace CMYK -profile "$iccProfilePath" -compress jpeg "$lowRes"
I'm running version 6.8..6-8 of IM on CentOS 6.4.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: CMYK PDF to PDF color change

Post by fmw42 »

probably best if you can post a link to your input PDF. You can upload to some free hosting service such as dropbox.com and put the link here.

Note that IM is not a very good system for going vector to vector. See http://www.imagemagick.org/Usage/formats/#vector


Also in this case what version of Ghostscript.
Nik
Posts: 37
Joined: 2009-09-16T03:54:58-07:00
Authentication code: 8675309

Re: CMYK PDF to PDF color change

Post by Nik »

Hi Fred,

Thanks for your response

the source PDF can be found here:
https://www.dropbox.com/s/l3mpdvwrrc11z ... e.pdf?dl=0

the output PDf can be found here:
https://www.dropbox.com/s/0niiclpxfi4s7 ... R.pdf?dl=0

The version of GS is 8.70. If I remember correctly they where installed using Yum and those specific versions where installed for a reason that escapes me now!

Both raster and vector objects appear to have been affected by the conversion.

I did read something before posting that am xml delegate could be edited to make GS use a specific profile when converting but I've been on so many pages today I can't find that now either!

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

Re: CMYK PDF to PDF color change

Post by fmw42 »

I cannot get a perfect match, but these two are better than yours. The second is the closest. I convert to sRGB and then use a profile to convert back to CMYK.

Code: Select all

convert -density 150 Example_File.pdf -compress jpeg tmp3.pdf
http://www.fmwconcepts.com/misc_tests/cmyk_pdf/tmp3.pdf

Code: Select all

convert -density 150 -colorspace sRGB Example_File.pdf \
-profile /Users/fred/images/profiles/sRGB.icc -profile \
/Users/fred/images/profiles/USWebCoatedSWOP.icc \
-compress jpeg tmp4.pdf
http://www.fmwconcepts.com/misc_tests/cmyk_pdf/tmp4.pdf


I am using IM 6.8.9.8 Q16 Mac OSX
GS 9.10
Nik
Posts: 37
Joined: 2009-09-16T03:54:58-07:00
Authentication code: 8675309

Re: CMYK PDF to PDF color change

Post by Nik »

Hi Fred,

thanks for your feedback and I can see that your second result is a lot closer than mine.

IM seems to be having problems with profiles though. I ran the below:

Code: Select all

convert -density 150 -colorspace sRGB '/home/imageuser/Desktop/Populate_Input/32-14-125-TRIAL-TRR.pdf' -profile '/home/imageuser/Desktop/ColorProfiles/AdobeRGB1998.icc' -profile '/home/imageuser/Desktop/ColorProfiles/CoatedFOGRA39.icc' -compress jpeg '/home/imageuser/Desktop/Populate_Input/tmp8.pdf' 
and got this feedback:

Code: Select all

convert: associate profile with image, a source and destination color profile required for transform `icc' @ profile.c/ProfileImage/812.
convert: Color profile operates on another colorspace `icc' @ profile.c/ProfileImage/1024
Does this mean anything to you?

Thanks,
Nik
Nik
Posts: 37
Joined: 2009-09-16T03:54:58-07:00
Authentication code: 8675309

Re: CMYK PDF to PDF color change

Post by Nik »

Hi Fred,

I have found a solution to my colour issues and that is to bypass IM and just use ghostscript! The below code gives me a lowres PDF with the colours correct and keeps the vectors as vectors:

Code: Select all

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sProcessColorModel=DeviceCMYK -sOutputFile="$lowRes" "$image1"
Only time will tell if GS struggles with an other vector based elements that are introduced, but for now this seems to do the trick.

Thanks for your help,
Nik
Post Reply