vespino
vespino

Reputation: 1940

Converting RGB PDF to CMYK PDF

I'm looking for a way to convert a PDF with RGB colors to one with CMYK colors. I have tried different programs like Ghostscript and PStill but none of them seem to do the right job. Does somebody know a ways that works 100% and can be run via the command line?

Upvotes: 4

Views: 986

Answers (1)

Martin Malec
Martin Malec

Reputation: 11

It can be achieved with Ghostscript, but with the help of collink tool from argyll which will prepare you a conversion (DeviceLink) ICC profile defining how to properly convert stuff from particular RGB to particular CMYK profile.

  1. Get the RGB input ICC profile your documents have, such as some basic sRGB icc file, if the original is supposed to be in sRGB. (If it's AdobeRGB use AdobeRGB input ICC etc.)

  2. Get the CMYK output ICC profile you would like documents convert to, for modern European offset printers nowadays a reasonable choice would be eciCMYK v2 which is a "CMYK exchange color space profile". (Also called FOGRA 59).

  3. Install collink tool from argyll package.

  4. Let collink create DeviceLink profile to calculate how to properly convert RGB to the particular CMYK. If you use "-f" parameter it will do an exception for neutral, grey and black color so they are not as rich CMYK black but a plain K black. It is expected to have both icc profiles in the working folder). Details in documentation at https://www.argyllcms.com/doc/collink.html saying for the -f parameter "Force neutral colors to be K only output."

    collink -v -f sRGB.icm eciCMYK_v2.icc sRGB_to_eciCMYK_v2.icc
    

    The result is a DeviceLink icc file sRGB_to_eciCMYK_v2.icc.

  5. Then create a control-sRGB.txt file to tell ghostscript parameters which devicelink profile to use for which and with which type of intent. You can do collink twice, make two profiles one for images to not put blacks to plain black but keep the blacks rich, and then another for text and graphics to force black content be purely from the black (K) ink plate. Note the separator between parameters in control file must be tabs, not spaces. Example:

    Image_RGB   sRGB_to_eciCMYK_v2.icc  0   1   0
    Graphic_RGB sRGB_to_eciCMYK_v2.icc  0   1   0
    Text_RGB    sRGB_to_eciCMYK_v2.icc  0   1   0
    
  6. Finally run Ghostscript this way, where 1-input-rgb.pdf is the input PDF in RGB, and 2-output-cmyk-from-sRGB.pdf is the output CMYK PDF:

    gs -o 2-output-cmyk-from-sRGB.pdf \
        -sDEVICE=pdfwrite \
        -sColorConversionStrategy=CMYK \
        -sSourceObjectICC=control-sRGB.txt \
        1-input-rgb.pdf
    

You can test the result in Adobe Acrobat Pro if you have the license, or open source Scribus (Edit menu-Colors, see screenshot below) to see all the colors used are CMYK, and with the -f setting of collink, black or greys are plain not rich black.

Note: Do not rely on Imagemagick identify command and such, it will not reliably tell whether all objects in the resuling PDF are CMYK or not, it will actually still write RGB which is not actually true.

Images:

Screenshot from Scribus 1.5.8 of a original RGB PDF and CMYK PDF after the conversion described above

Upvotes: 1

Related Questions