【问题标题】:Ghostscript tiffsep creates CMYK image that is inverted in ImageMagick display?Ghostscript tiffsep 创建在 ImageMagick 显示中反转的 CMYK 图像?
【发布时间】:2017-04-10 21:16:57
【问题描述】:

不知道该怎么做 - 但假设我们使用这个 PDF 文件:https://stlab.adobe.com/wiki/index.php/File:Test.pdf,我想使用 Ghostscript 的tiffsep 设备获得分色:

cd /tmp
wget https://stlab.adobe.com/wiki/images/d/d3/Test.pdf
ghostscript -q -sDEVICE=tiffsep -dNOPAUSE -dBATCH -dSAFER -r72x72 -sOutputFile=testseps.tif -dFirstPage=1 -dLastPage=1 Test.pdf
eog testseps.tif & display testseps.tif

这会生成五个文件:testseps(Black).tiftestseps(Cyan).tiftestseps(Magenta).tiftestseps.tiftestseps(Yellow).tif。我在 Gnome 之眼 (eog) 和 ImageMagick 的 display 中打开全彩输出 (testseps.tif),这就是我得到的结果(Ubuntu 14.04、MATE 桌面、ghostscript 9.10、ImageMagick 6.7.7- 10 2017-03-14 Q16):

也就是说,ImageMagick 的display(左)用反色显示这个文件,而 Eye of Gnome(右)正确地显示同一个文件?!

那么我怎样才能让这个 CMYK tiff 在 display 和 Eye of Gnome 中正确显示?我可以用 ImageMagick 的convert 以某种方式转换它吗?命令行是什么?我已经尝试过类似的方法:

convert testseps.tif -colorspace CMYK -alpha off -define quantum:polarity=min-is-white -colorspace CMYK testseps2.tif

...该文件再次显示相同的问题。

编辑:另外,如果我尝试使用 convert 组合各个分色:

convert \
testseps\(Cyan\).tif \
testseps\(Magenta\).tif \
testseps\(Yellow\).tif \
testseps\(Black\).tif \
-set colorspace CMYK \
-profile /usr/share/ghostscript/9.10/iccprofiles/default_cmyk.icc 
-combine 
combined.tif

...然后combined.tif 在 ImageMagick display 中正确显示 - 但在 Eye of Gnome 中显示为完全黑色!如果我在-combine 之后添加-negate 开关,那么我会回到之前的状态(display 显示反转,eog 显示正确)

EDIT2:尝试使用服务http://www.rgb2cmyk.org/,获取此处发布的 RGB 屏幕截图的 CMYK tif,并且该服务还显示了相同的错误:它在 display 中反转,并在 Gnome 之眼中正确显示.

仅供参考,这里有一些关于testseps.tif的信息:

$ tiffinfo testseps.tif 
TIFF Directory at offset 0x8 (8)
  Subfile Type: multi-page document (2 = 0x2)
  Image Width: 612 Image Length: 792
  Resolution: 72, 72 pixels/inch
  Bits/Sample: 8
  Compression Scheme: LZW
  Photometric Interpretation: separated
  FillOrder: msb-to-lsb
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 4
  Rows/Strip: 428
  Planar Configuration: single image plane
  Page Number: 0-0
  Software: GPL Ghostscript 9.10
  DateTime: 2017:04:10 12:53:45
  ICC Profile: <present>, 56412 bytes
$ identify -verbose testseps.tif 
Image: testseps.tif
  Format: TIFF (Tagged Image File Format)
  Class: DirectClass
  Geometry: 612x792+0+0
  Resolution: 72x72
  Print size: 8.5x11
  Units: PixelsPerInch
  Type: ColorSeparation
  Endianess: MSB
  Colorspace: CMYK
  Depth: 8-bit
  Channel depth:
    cyan: 8-bit
    magenta: 8-bit
    yellow: 8-bit
    black: 8-bit
  Channel statistics:
    Cyan:
      min: 0 (0)
      max: 235 (0.921569)
      mean: 5.93515 (0.0232751)
      standard deviation: 33.3466 (0.130771)
      kurtosis: 28.8423
      skewness: 5.53334
    Magenta:
      min: 0 (0)
      max: 245 (0.960784)
      mean: 2.7823 (0.010911)
      standard deviation: 18.73 (0.0734511)
      kurtosis: 68.8725
      skewness: 8.12072
    Yellow:
      min: 0 (0)
      max: 255 (1)
      mean: 5.04176 (0.0197716)
      standard deviation: 30.8529 (0.120992)
      kurtosis: 34.9211
      skewness: 6.05297
    Black:
      min: 0 (0)
      max: 226 (0.886275)
      mean: 1.06569 (0.00417917)
      standard deviation: 13.7509 (0.0539252)
      kurtosis: 227.454
      skewness: 15.0002
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 3.70622 (0.0145342)
      standard deviation: 25.5137 (0.100054)
      kurtosis: 51.8946
      skewness: 7.28691
  Total ink density: 298%
  Rendering intent: Undefined
  Gamma: 1
  Interlace: None
  Background color: cmyk(255,255,255,0)
  Border color: cmyk(223,223,223,0)
  Matte color: cmyk(189,189,189,0)
  Transparent color: cmyk(0,0,0,0)
  Compose: Over
  Page geometry: 612x792+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: LZW
  Orientation: TopLeft
  Properties:
    date:create: 2017-04-10T12:53:45+02:00
    date:modify: 2017-04-10T12:53:45+02:00
    signature: 1ad1532f697fa72492fe994d79f1b67d617a34cd927f31b41e6a12214b9bc49e
    tiff:endian: lsb
    tiff:photometric: separated
    tiff:rows-per-strip: 428
    tiff:software: GPL Ghostscript 9.10
    tiff:timestamp: 2017:04:10 12:53:45
  Profiles:
    Profile-icc: 187484 bytes
      Description: Artifex CMYK SWOP Profile
      Manufacturer: Artifex CMYK SWOP Profile
      Model: Artifex CMYK SWOP Profile
      Copyright: Copyright Artifex Software 2011
  Artifacts:
    filename: testseps.tif
    verbose: true
  Tainted: True
  Filesize: 220KB
  Number pixels: 485K
  Pixels per second: 24.24MB
  User time: 0.020u
  Elapsed time: 0:01.019
  Version: ImageMagick 6.7.7-10 2017-03-14 Q16 http://www.imagemagick.org

【问题讨论】:

标签: imagemagick ghostscript


【解决方案1】:

我怀疑这里没有真正的错误,当然也不是 Ghostscript 错误。问题在于 0 的解释。

您的显示器无法显示 CMYK 墨水,因此需要将文件中的 CMYK 转换为 RGB 才能显示。现在对于 RGB,当 R=G=B=0 时结果为黑色,当 R=G=B=1(8 位显示器为 0r 255)时结果为白色。

RGB 是加色模型,CMYK 相比之下是减色模型;当您放置多种墨水时,实际上是从页面反射的光中减去,而不是在 RGB 中添加光以获得颜色。

所以当你得到 C=M=Y=K=0 时,这实际上意味着什么?一般的约定是它意味着白色,因为人们通常在白色介质上打印。当然,如果您的纸张是绿色的,那么打印 CMYK=0 的结果就不会是“白色”,而是绿色。

将 CMYK 中没有着色剂表示为 RGB 中没有着色剂是可以理解的(如果非常规的话)。所以 CMYK=0 -> RGB=0 结果是黑色的。

当然,按照惯例,我们希望 CMYK=0 为白色。

我不是 ImageMagick 方面的任何专家,但我怀疑这是怎么回事,它进行 CMYK->RGB 转换并将 CMYK=0 映射到 RGB=0,所以你得到黑色。假设使用 convert 组合分色的输出是 CMYK 文件,您可以查看光栅的前几个字节以了解 IM 如何写入 CMYK=0。要么你会得到 00 00 00 00 要么你会得到别的东西。您可能还想查看 PhotmetricInterpretation TIFF 标签,看看它在这两种情况下是如何设置的。

无论如何,如果它在解释 photometricitry 的方式上有所不同,那么我认为不可能获得在两个应用程序上都可以按预期工作的单个文件。一个认为 CMYK=0 是黑色的,另一个认为它是白色的。

【讨论】:

  • 谢谢你,@KenS - 这个分析看起来很合理,记住这一点很好。
猜你喜欢
  • 2014-06-11
  • 2013-07-25
  • 1970-01-01
  • 1970-01-01
  • 2019-10-22
  • 1970-01-01
  • 2017-01-23
  • 1970-01-01
  • 2017-05-07
相关资源
最近更新 更多