- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我很难让 ImageMagick 的 identify
将 PDF 识别为 CMYK。
基本上,假设我正在使用 pdflatex
构建这个文件 test.tex
:
\documentclass[a4paper,12pt]{article}
%% https://tex.stackexchange.com/questions/13071
\pdfcompresslevel=0
%% http://compgroups.net/comp.text.tex/Making-a-cmyk-PDF
%% ln -s /usr/share/color/icc/sRGB.icm .
% \immediate\pdfobj stream attr{/N 4} file{sRGB.icm}
% \pdfcatalog{%
% /OutputIntents [ <<
% /Type /OutputIntent
% /S/GTS_PDFA1
% /DestOutputProfile \the\pdflastobj\space 0 R
% /OutputConditionIdentifier (sRGB IEC61966-2.1)
% /Info(sRGB IEC61966-2.1)
% >> ]
% }
%% http://latex-my.blogspot.com/2010/02/cmyk-output-for-commercial-printing.html
%% https://tex.stackexchange.com/questions/9961
\usepackage[cmyk]{xcolor}
\begin{document}
Some text here...
\end{document}
如果我随后尝试识别生成的 test.pdf
文件,无论我尝试过什么选项(至少根据源代码中的链接),我都会将其作为 RGB 获取 - 并且但是,其中的颜色将保存为 CMYK;对于上面的来源:
$ grep -ia 'cmyk\|rgb\| k' test.pdf
0 0 0 1 k 0 0 0 1 K
0 0 0 1 k 0 0 0 1 K
0 0 0 1 k 0 0 0 1 K
0 0 0 1 k 0 0 0 1 K
FontDirectory/CMR12 known{/CMR12 findfont dup/UniqueID known{dup
/PTEX.Fullbanner (This is pdfTeX, Version 3.1415926-1.40.11-2.2 (TeX Live 2010) kpathsea version 6.0.0)
$ identify -verbose 'test.pdf[0]'
...
Type: Palette
Endianess: Undefined
Colorspace: RGB
Depth: 16/8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
Channel statistics:
Red:
...
Green:
...
Blue:
...
Histogram:
5: (12593,11565,11822) #31312D2D2E2E rgb(49,45,46)
4: (16448,15420,15677) #40403C3C3D3D rgb(64,60,61)
9: (20303,19275,19532) #4F4F4B4B4C4C rgb(79,75,76)
25: (23901,23130,23387) #5D5D5A5A5B5B rgb(93,90,91)
...
如果我也取消注释 \immediate\pdfobj stream ...
部分;然而,如果文档中只有一种颜色(黑色),我看不到 identify
在哪里得出 RGB 值的直方图(尽管可以说,它们都接近灰色)?!
所以没关系,然后我最好尝试使用 ghostscript
将 test.pdf
转换为新的 pdf,它将被识别为 CMYK identify
- 但即使在那里也没有运气:
$ gs -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile=test-gs.pdf -dUseCIEColor -sProcessColorModel=DeviceRGB -dProcessColorModel=/DeviceCMYK -sColorConversionStrategy=/CMYK test.pdf
GPL Ghostscript 9.01 (2011-02-07)
Copyright (C) 2010 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
$ identify -verbose 'test-gs.pdf[0]'
...
Type: Grayscale
Base type: Grayscale
Endianess: Undefined
Colorspace: RGB
Depth: 16/8-bit
...
因此,唯一被识别
视为变化的是Type: Grayscale
(来自之前的Type: Palette
);但除此之外它仍然看到 RGB 色彩空间!
除此之外,请注意 identify
能够正确报告 CMYK pdf - 参见 CMYK poster example: fitting pdf page size to (bitmap) image size? #17843 - TeX - LaTeX - Stack Exchange有关使用 convert
和 gs
生成此类 PDF 文件的命令行示例。其实我们可以执行:
convert test.pdf -depth 8 -colorspace cmyk -alpha Off test-c.pdf
... 而这将生成一个 PDF,该 PDF 将被识别
为 CMYK - 然而,PDF 也将被光栅化(默认为 72 dpi)。
编辑:我刚刚发现,如果我在 OpenOffice 中创建一个 .odp 演示文稿,并将其导出为 PDF;该 PDF 默认为 RGB,但是,以下命令(来自 ghostscript Examples | Production Monkeys):
# Color PDF to CMYK:
gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite \
-sColorConversionStrategy=CMYK -dProcessColorModel=/DeviceCMYK \
-sOutputFile=output.pdf input.pdf
...实际上将生成一个 CMYK pdf,由 identify
报告(尽管黑色会很丰富,而不是纯色 - 在所有四个 channel 上);但是,此命令仅在幻灯片添加图像时起作用(显然,它是触发颜色转换的图像?!)!有趣的是,我无法从 pdflatex
PDF 中获得相同的效果。
所以我想我的问题可以通过两种方式提出:
identify
中被识别(并因此构建正确的直方图CMYK 颜色)identify
的命令行 Linux 工具,即使在 pdflatex 的原始 test.pdf
中也能正确识别 CMYK 颜色的使用
(并可能根据任意选择的 PDF 页面构建颜色直方图,就像 identify
应该做的那样)?提前感谢您的任何回答,
干杯!
一些引用资料:
Is it for instance specified as "0 0 0 1 setcmykcolor"? Or possibly rather as "0 0 0 setrgbcolor"? In the latter case you would end up with a rich black for text, if DeviceRGB is remapped to a CIE-based color space in order to get RGB images color managed.
最佳答案
sdaau,您尝试将 PDF 转换为 CMYK 时使用的命令不正确。试试这个:
gs \
-o test-cmyk.pdf \
-sDEVICE=pdfwrite \
-sProcessColorModel=DeviceCMYK \
-sColorConversionStrategy=CMYK \
-sColorConversionStrategyForImages=CMYK \
test.pdf
如果颜色转换未按预期工作并且您看到类似“无法将颜色空间转换为灰色,将策略恢复为 LeaveColorUnchanged”的消息,则...
在这种情况下,将 -dOverrideICC
添加到命令行,看看它是否会根据需要更改结果。
避免 JPEG artifacts appearing在图片中(以前没有的地方),添加:
-dEncodeColorImages=false
进入命令行。
(几乎所有 GS PDF->PDF 处理都是如此,不仅仅是这种情况。因为 GS 默认情况下会在询问时创建一个全新的文件,其中包含新构造的对象和新的文件结构生成 PDF 输出——它不会简单地重复使用以前的对象,因为像 pdftk
这样更“愚蠢”的 PDF 处理器确实 {pdftk
还有其他尽管有优点,但不要误解我的说法!。GS 默认应用 JPEG 压缩——查看当前的 Ps2pdf documentation 并搜索 “ColorImageFilter” 了解更多详情...)
关于linux - Converting PDF to CMYK (with identifying CMYK),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6241282/
我的代码有一些问题。我正在尝试遍历包含许多 PDF 的 Drive 文件夹,然后将它们合并为一个文件。当我使用我的代码时,它只是为 Drive 文件夹中的最后一个 PDF 创建一个 PDF,而不是按预
我从 PDF Specification 获取了 PDF 规范中的最小 PDF 示例。 ,将其复制到记事本,将文件重命名为扩展名为 .pdf。 我可以用其他 PDF 查看器(PDF-XChange、S
感谢您在以下方面的帮助: 我有 2 个部分可访问的 PDF(包含标签),我想使用一些命令行工具(如 PDFtk 或 Ghostscript,或任何 Perl 模块)将它们连接起来: 我已经尝试使用 P
我想使用 ghostscript 将矢量 pdf 转换为光栅 pdf(即光栅化矢量 pdf)。但是即使我添加了解析参数 -r300,我也找不到合适的参数来执行此操作。 我使用的代码是-dSAFER -
我无法在 FAQ 中找到这个功能是否存在于 API 中,尽管它在书中提到作为潜在可用的东西。有没有人有任何实现此功能的经验? 最佳答案 在 This thread (日期为 2007 年 6 月)Pa
我要放文件sample.pdf在我的网站上,并希望使用 pdf.js 显示它.我想要的是显示我自己的文件,如 demo ,带有工具栏,放大/缩小等。到目前为止,我还不能这样做。 我确实检查了 hell
我知道这可能不是严格意义上的编程问题(也许是,我不知道)但我在尝试转换常规 pdf(带有超链接、书签、图像、嵌入字体等)时遇到了严重问题.) 转换为 PDF/A-1 格式。 当我用 pdfaPilot
这是 PDF.js 网站 https://github.com/mozilla/pdf.js 我正在搜索和阅读很多文章,大多数编码都是将 pdf 导入 pdf.js 并在浏览器上显示,我不明白是不是
谁能建议我如何将扫描图像转换为可搜索图像或如何将扫描 pdf 转换为可搜索 pdf? 很长一段时间以来,我一直陷入这种情况。 我已经在 ubuntu 中尝试过 pdfocr 应用程序,但没有成功。 最
作为我对客户端/服务器 pdf 签名研究的一部分,我测试了 itext pdf 延迟签名示例。不幸的是,我生成的 pdf 即合并空签名 pdf 和哈希值的输出显示无效签名。 我的代码片段如下 cla
我想将一个 PDF 页面插入到另一个已缩放的 PDF 页面中。我想使用 iTextSharp 来实现此目的。 我有一个矢量绘图,可以导出为单页 PDF 文件。我想将此文件添加到其他 PDF 文档的页面
作为我对客户端/服务器 pdf 签名研究的一部分,我测试了 itext pdf 延迟签名示例。不幸的是,我生成的 pdf 即合并空签名 pdf 和哈希值的输出显示无效签名。 我的代码片段如下 cla
我想为 Kindle 转换电子书。我尝试使用 Calibre 将具有复杂格式样式和图像的基于两种语言的基于文本的大型 PDF 电子书转换为适用于 Kindle 的 AZW3 电子书,并且还尝试了亚马逊
我在 Google Chrome 中显示 pdf 时遇到问题。问题是 Chrome 将 pdf 的某些页面显示为黑色。 启用 Chrome PDF 查看器时会发生这种情况。如果我禁用此插件并使用 Ad
我确信这个问题无处不在,尽管我似乎找不到答案。我希望我的 PDF 文档在 PDF 阅读器中显示时没有空白页,但随后在封面后打印空白页,这样打印出来的文档在右侧甚至左侧都有奇数页。还有其他人遇到过这个问
我需要自动裁剪 pdf 文件(去除白边)。到目前为止,我尝试了两种并不完美的工具: pdf裁剪 问题:它不会裁剪某些 pdf。 pdf-crop-margins 问题:有时它裁剪得太多(精细的细节)。
This PDF由几个源文件组成。其中五个是包含 alpha channel 的 PNG。一种是没有 alpha channel 的 PNG。最后一 block 是带有透明效果的 Photoshop
我的团队将内部 wiki 页面用于各种内容。这些页面是使用 MediaWiki 创建的。我想知道是否有任何方法可以将 wiki 页面转换为 PDF 格式。我必须用它来将用户文档转换为 PDF 格式,以
我希望能够从我可能在数据库或 xml 或任何其他结构化形式中拥有的数据生成高度图形化(也包含大量文本内容)的 PDF 文件。 目前,我们的平面设计师在将内容作为 MS Word 文档后,在 Photo
我正在寻找可以帮助我找到重复 PDF 的实用程序。问题:我有 1000 个 PDF 文件。有些是重复的。由于不同的文件名和文件大小的微小差异,它们不容易被检测到。是否有实用程序/算法/库可以帮助我找到
我是一名优秀的程序员,十分优秀!