以PDF格式嵌入ICC颜色配置文件

Tha*_*yne 8 linux pdf color-management ghostscript color-profile

我正在生成一个PDF,其中所有图形都在sRGB颜色空间的\ DeviceRGB中绘制.我想使用ICC配置文件将PDF转换为不同的颜色配置文件并嵌入ICC配置文件,但我找不到一个好的工具来执行此操作.

我尝试过ImageMagick,但是光栅化PDF是不可取的,我尝试过使用Ghostscript.但是虽然它会转换颜色,但它不会嵌入ICC配置文件.

是否有可用于Linux的工具或库(最好是Java或Scala)可以满足我的需求?

我尝试过的Ghostscript命令是:

gs -o cmyk.pdf -sColorConversionStrategy=CMYK -sDEVICE=pdfwrite \
   -dOverrideICC=true -sOutputICCProfile=CoatedFOGRA27.icc \
   -dRenderIntent=3 in.pdf
Run Code Online (Sandbox Code Playgroud)

gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -ColorConversionStrategy=CMYK \
   -dProcessColorModel=/DeviceCMYK -sOutputICCProfile=CoatedFOGRA27.icc \
   -sOutputFile=cmyk.pdf in.pdf 
Run Code Online (Sandbox Code Playgroud)

以及上述的几种变化.我已经尝试了Ghostscript版本9.10和9.16.

Kur*_*fle 5

使用Ghostscript。

使用最新版本v9.16。

在这里下载:

阅读其有关ICC色彩配置文件支持的(最新)文档,可在此处获取:

A command that will convert the color space and embed the ICC profile is this:

gs -o cmyk-doc.pdf      \
   -sDEVICE=pdfwrite    \
   -dOverrideICC=true   \
   -sDefaultCMYKProfile=/path/to/mycmykprofile.icc \
   -sOutputICCProfile=/path/to/mydeviceprofile.icc \
   -dRenderIntent=3     \
   -dDeviceGrayToK=true \
    input-doc.pdf
Run Code Online (Sandbox Code Playgroud)

(-dRenderIntent : possible arguments are 0 (Perceptual), 1 (Colorimetric), 2 (Saturation), and 3 (Absolute Colorimetric).)

Caveats

If you look at a PDF file on screen (or on paper, when printed) converted with above command and use...

  • ...a non-calibrated monitor/screen,
  • ...a non-calibrated print device,
  • ...a non-calibrated room illumination,
  • ...a PDF reader which cannot handle embedded ICC profiles,

you can be up for heavy disappointment. Or you used a wrong ICC profile. Or you used a paper type which does not match the one expected by the output profile. Or you don't understand ICC color management sufficiently well enough.

但是,不要以令人意外的结果来指责Ghostscript带来的意外结果……