I am generating a PDF where all the graphics are drawn in \DeviceRGB in the sRGB color space. I would like to convert the PDF into a different Color Profile using an ICC profile and embed the ICC profile, but I can't find a good tool to do this.
I have tried ImageMagick, but that rasterizes the PDF which is undesirable, and I have tried using Ghostscript. But while that converts the colors, it doesn't embed the ICC profile.
Is there any tool or library (preferably Java or Scala) available for Linux that does what I want?
The Ghostscript commands I have tried are:
gs -o cmyk.pdf -sColorConversionStrategy=CMYK -sDEVICE=pdfwrite \
-dOverrideICC=true -sOutputICCProfile=CoatedFOGRA27.icc \
-dRenderIntent=3 in.pdf
and
gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -ColorConversionStrategy=CMYK \
-dProcessColorModel=/DeviceCMYK -sOutputICCProfile=CoatedFOGRA27.icc \
-sOutputFile=cmyk.pdf in.pdf
and several variations of the above. I have tried both Ghostscript version 9.10 and 9.16.
CoatedFOGRA27.icc
, is indeed located in the directory where you execute your shell command? Otherwise, it must be in one of Ghostscript's default search paths, as reported bygs -h
. – Nickelson