在PDF中嵌入ICC颜色配置文件 [英] Embed ICC color profile in PDF

查看:1687
本文介绍了在PDF中嵌入ICC颜色配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

我尝试了ImageMagick,但是这将PDF光栅化了,这是不希望的,并且我尝试使用Ghostscript.但是,虽然可以转换颜色,但不会嵌入ICC配置文件.

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.

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

Is there any tool or library (preferably Java or Scala) available for Linux that does what I want?

我尝试过的Ghostscript命令是:

The Ghostscript commands I have tried are:

gs -o cmyk.pdf -sColorConversionStrategy=CMYK -sDEVICE=pdfwrite \
   -dOverrideICC=true -sOutputICCProfile=CoatedFOGRA27.icc \
   -dRenderIntent=3 in.pdf

gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -ColorConversionStrategy=CMYK \
   -dProcessColorModel=/DeviceCMYK -sOutputICCProfile=CoatedFOGRA27.icc \
   -sOutputFile=cmyk.pdf in.pdf 

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

and several variations of the above. I have tried both Ghostscript version 9.10 and 9.16.

推荐答案

使用Ghostscript v9.16或更高版本:

Use Ghostscript v9.16 or higher:

在以下位置阅读其有关ICC色彩配置文件支持的文档:

Read its documentation about ICC color profile support, available here:

以下是可能的命令,用于转换色彩空间并嵌入ICC配置文件:

Here's a possible command to convert the color space and embed the ICC profile:

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

(-dRenderIntent:可能的参数为0(感知),1(比色),2(饱和度)和3(绝对比色).)

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

如果您在屏幕上(或打印时在纸上,在打印时)查看通过上述命令转换的PDF文件,并使用:

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

  • 未校准的显示器/屏幕;
  • 未校准的打印设备;
  • 未校准的房间照明;或
  • 无法处理嵌入式ICC配置文件的PDF阅读器,然后

您可能会感到失望.如果使用错误的ICC配置文件或纸张类型与输出配置文件所期望的纸张类型不匹配,也会导致问题.

you may be disappointed. Using the wrong ICC profile or paper type that does not match the one expected by the output profile can also lead to issues.

这篇关于在PDF中嵌入ICC颜色配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆