简体   繁体   English

如何强制 Ghostscript 使用 CMYK colors 而不是 RGB 将 PDF 转换为单色 bitmap?

[英]How to force Ghostscript to convert PDF to monochrome bitmap using CMYK colors instead of RGB?

I have a PDF file containing black text specified with CMYK color of 0,0,0,100.我有一个 PDF 文件,其中包含指定 CMYK 颜色为 0,0,0,100 的黑色文本。 When I convert this to "bmpmono" using ghostscript, it interprets this as not 100% black.当我使用 ghostscript 将其转换为“bmpmono”时,它会将其解释为不是 100% 黑色。 I discovered that CMYK 0,0,0,100 actually converts to RGB of around 36,32,33 and not 0,0,0 as I had expected (but is explained here ).我发现 CMYK 0,0,0,100 实际上转换为大约 36,32,33 的 RGB 而不是我预期的 0,0,0(但在此处进行了解释)。

I believe what's happening is ghostscript is converting the CMYK to RGB and then to monochrome, so I end up with non-fully-black text.我相信发生的事情是 ghostscript 将 CMYK 转换为 RGB,然后再转换为单色,所以我最终得到的是非全黑文本。 Is there a way to force ghostscript to stick with the CMYK and directly convert to monochrome to keep the 100% black?有没有办法强制 ghostscript 坚持 CMYK 并直接转换为单色以保持 100% 黑色?

Here is my command:这是我的命令:

gswin64c.exe -dNOPAUSE -sDEVICE=bmpmono -dBATCH -dDEVICERESOLUTION=200 -sOutputFile=testout.bmp -f source.pdf

GS will do a conversion from CMYK to Gray through the defined ICC profiles. GS 将通过定义的 ICC 配置文件从 CMYK 转换为灰色。 There are darker CMYK values that exist (for GS's defined CMYK source profile -- and for most) compared to a CMYK value of [0 0 0 100] So, [0 0 0 100] ends up being mapped to something that is not the darkest in the Gray output space.与 [0 0 0 100] 的 CMYK 值相比,存在更暗的 CMYK 值(对于 GS 定义的 CMYK 源配置文件 - 对于大多数)因此,[0 0 0 100] 最终被映射到不是灰色 output 空间中最暗。

A couple options would be to try有几个选择是尝试

-dUseFastColor -dUseFastColor

which will avoid the use of ICC profiles for color mapping and use old school 255-X with UCR/BG type mappings.这将避免使用 ICC 配置文件进行颜色映射,并使用带有 UCR/BG 类型映射的老式 255-X。

Another option is to use另一种选择是使用

-dBlackText=true -dBlackText=真

This will force all text components (except for Type 3 fonts) to be filled (or stroked) with a gray value of 0 which should map to 0 for the bmpmono device.这将强制所有文本组件(Type 3 字体除外)用灰色值 0 填充(或描边),对于 bmpmono 设备,该值应为 map 至 0。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM