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

查看:32
本文介绍了在 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 (Perceptual), 1 (Colorimetric), 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:

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

你可能会失望.使用错误的 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天全站免登陆