如何转储PDF中的嵌入式ICC配置文件信息? (命令行或GUI工具) [英] How do I dump embedded ICC profile information in PDF? (command line or GUI tools)
问题描述
是否有命令行或GUI工具转储有关ICC配置文件/颜色转换的信息,这些信息在Illustrator的PDF导出对话框中设置为颜色管理和PDF的PDF/X选项"选项? /p>
Illustrator的颜色管理和PDF的PDF/X选项"选项
[image] http://blogs.adobe.com/vikrant /files/2012/05/grayscale_export.png
此处是基于命令行的方法,用于从PDF中提取ICC颜色配置文件.它使用编写的Python脚本 pdf-parser.py 由安全研究员Didier Stevens编写,您可以在此处下载.
但是,该工具不是用于ICC提取的专业工具. (我不知道这样的工具.)它是研究PDF文件的通用命令行工具.
因此,您需要经历多个步骤才能完成提取.
步骤1:确定ICC配置文件的PDF对象ID
您必须使用-s
搜索字符串ICCBased
. (没有嵌入式ICC配置文件的PDF文件将没有此关键字[[可能在其文本内容中使用它...].)
pdf-parser -s ICCBased my.pdf
我的测试PDF返回此:
obj 18 0
Type:
Referencing: 21 0 R
似乎在PDF对象21中可以找到一个ICC配置文件.
第2步:查看在第1步中找到的PDF对象
您必须使用-o 21
来查看什么是PDF对象21:
pdf-parser.py -o 21 my.pdf
我的测试PDF返回以下内容:
obj 21 0
Type:
Referencing:
Contains stream
<<
/Alternate /DeviceRGB
/Filter /FlateDecode
/Length 2574
/N 3
>>
好吧,看来我们已经接近了……
步骤3:转储包含配置文件的PDF对象中包含的流
在第2步中,我们获得了两个重要信息:
- PDF对象21包含一个流(通过使用
pdf-parser.py
的-o 21
参数未显示其内容). - 必须使用
/FlateDecode
对对象流进行解压缩,以获取其内容.
因此,我们现在必须使用两个附加参数来运行pdf-parser.py
:
-
-d filename
,以便将PDF对象21的流转储到文件中. -
-f
,以便在将对象流转储到文件时对其进行过滤/解压缩. - 要运行的命令:
pdf-parser.py -o 21 -f -d 21.stream my.pdf
第4步:验证提取的内容
我们现在将PDF对象21的流转储到名为21.stream
的文件中.让我们看看它包含的内容:
file 21.stream
21.stream: Microsoft ICM Color Profile
看起来我们成功了. :-)
第5步:打开颜色配置文件
我将查看我的Mac OSX系统是否接受此配置文件:
mv 21.stream 21.icm
open 21.icm
OSX使用'Color Sync Utility'打开文件并显示一个窗口.单击列表条目会在窗口底部打开不同的信息窗格:
步骤6:使用Argyll的iccdump
将ICC配置文件的内容作为文本转储
请注意,Graeme Gill的 ArgyllCMS 是一种开放源码的色彩管理软件,可用于Linux,Mac OSX和Windows,它附带了一整套命令行工具.其中之一是iccdump
.我们可以使用它来查看新获得的21.icm
文件的属性:
iccdump 21.icm icc: Header: size = 3144 bytes CMM = 'Lino' Version = 2.1.0 Device Class = Display Color Space = RGB Conn. Space = XYZ Date, Time = 9 Feb 1998, 6:49:00 Platform = Microsoft Flags = Not Embedded Profile, Use anywhere Dev. Mnfctr. = 'IEC ' Dev. Model = 'sRGB' Dev. Attrbts = Reflective, Glossy Rndrng Intnt = Perceptual Illuminant = 0.964203, 1.000000, 0.824905 [Lab 100.000000, 0.000498, -0.000436] Creator = 'HP ' tag 0: sig 'cprt' type 'text' offset 336 size 51 Text: No. chars = 43 0x0000: Copyright (c) 1998 Hewlett-Packard Company tag 1: sig 'desc' type 'desc' offset 388 size 108 TextDescription: ASCII data, length 18 chars: 0x0000: sRGB IEC61966-2.1 No Unicode data ScriptCode Data, Code 0x0, length 18 chars 0x0000: 73 52 47 42 20 49 45 43 36 31 39 36 36 2d 32 2e 31 00 tag 2: sig 'wtpt' type 'XYZ ' offset 496 size 20 XYZArray: No. elements = 1 tag 3: sig 'bkpt' type 'XYZ ' offset 516 size 20 XYZArray: No. elements = 1 tag 4: sig 'rXYZ' type 'XYZ ' offset 536 size 20 XYZArray: No. elements = 1 tag 5: sig 'gXYZ' type 'XYZ ' offset 556 size 20 XYZArray: No. elements = 1 tag 6: sig 'bXYZ' type 'XYZ ' offset 576 size 20 XYZArray: No. elements = 1 tag 7: sig 'dmnd' type 'desc' offset 596 size 112 TextDescription: ASCII data, length 22 chars: 0x0000: IEC http://www.iec.ch No Unicode data ScriptCode Data, Code 0x0, length 22 chars 0x0000: 49 45 43 20 68 74 74 70 3a 2f 2f 77 77 77 2e 69 65 63 2e 63 68 00 tag 8: sig 'dmdd' type 'desc' offset 708 size 136 TextDescription: ASCII data, length 46 chars: 0x0000: IEC 61966-2.1 Default RGB colour space - sRGB No Unicode data ScriptCode Data, Code 0x0, length 46 chars 0x0000: 49 45 43 20 36 31 39 36 36 2d 32 2e 31 20 44 65 66 61 75 6c 74 20 ... tag 9: sig 'vued' type 'desc' offset 844 size 134 TextDescription: ASCII data, length 44 chars: 0x0000: Reference Viewing Condition in IEC61966-2.1 No Unicode data ScriptCode Data, Code 0x0, length 44 chars 0x0000: 52 65 66 65 72 65 6e 63 65 20 56 69 65 77 69 6e 67 20 43 6f 6e 64 ... tag 10: sig 'view' type 'view' offset 980 size 36 Viewing Conditions: XYZ value of illuminant in cd/m^2 = 19.644501, 20.371796, 16.808899 XYZ value of surround in cd/m^2 = 3.928894, 4.074387, 3.361786 Illuminant type = D50 tag 11: sig 'lumi' type 'XYZ ' offset 1016 size 20 XYZArray: No. elements = 1 tag 12: sig 'meas' type 'meas' offset 1036 size 36 Measurement: Standard Observer = 1931 Two Degrees XYZ for Measurement Backing = 0.000000, 0.000000, 0.000000 [Lab 0.000000, 0.000000, 0.000000] Measurement Geometry = Unknown Measurement Flare = 1.0% Standard Illuminant = D65 tag 13: sig 'tech' type 'sig ' offset 1072 size 12 Signature Technology = Cathode Ray Tube Display tag 14: sig 'rTRC' type 'curv' offset 1084 size 2060 Curve: No. elements = 1024 tag 15: sig 'gTRC' type 'curv' offset 1084 size 2060 Curve: No. elements = 1024 tag 16: sig 'bTRC' type 'curv' offset 1084 size 2060 Curve: No. elements = 1024
PS:
ArgyllCMS包含命令行工具extracticc
,该工具可以从TIFF文件中提取嵌入式ICC配置文件.它没有从PDF文件提取配置文件的工具.
It there a command line or GUI tools to dump information about ICC Profile/color conversion, which are set "Color management and PDF/X options for PDF" option of Illustrator's PDF export dialog?
"Color management and PDF/X options for PDF" option of Illustrator
[image] http://blogs.adobe.com/vikrant/files/2012/05/grayscale_export.png
Here is a command line based method to extract ICC color profiles from a PDF. It uses the Python script pdf-parser.py written by security researcher Didier Stevens which you can download here.
However, this tool is not a specialized tool for ICC extraction. (I do not know such a tool.) It is a generic command line tool to investigate PDF files.
Therefor you need to go through various steps in order to achieve the extraction.
Step 1: Determine the PDF object ID of the ICC profile
You have to use -s
to search for the string ICCBased
. (PDF files without an embedded ICC profile will not have this keyword [with the exception of possibly using it in their text contents...].)
pdf-parser -s ICCBased my.pdf
My test PDF returned this:
obj 18 0
Type:
Referencing: 21 0 R
It seems that an ICC profile is to be found in PDF object 21.
Step 2: Look at the PDF object found in step 1
You have to use -o 21
to see what PDF object 21 is:
pdf-parser.py -o 21 my.pdf
My test PDF returns this:
obj 21 0
Type:
Referencing:
Contains stream
<<
/Alternate /DeviceRGB
/Filter /FlateDecode
/Length 2574
/N 3
>>
Ok, this looks like we are getting close...
Step 3: Dump the stream contained in the PDF object containing the profile
In step 2 we acquired two important infos:
- The PDF object 21 contains a stream (the contents of which are not shown by using the
-o 21
parameter ofpdf-parser.py
). - The object stream has to be de-compressed with the
/FlateDecode
in order to get to its content.
Hence we have to run pdf-parser.py
now with two additional arguments:
-d filename
in order to dump the stream of PDF object 21 to a file.-f
in order to filter/un-compress the object stream when dumping it to a file.- Command to run:
pdf-parser.py -o 21 -f -d 21.stream my.pdf
Step 4: Verify what was extracted
We now have dumped the stream of PDF object 21 to a file named 21.stream
. Let's see what it contains:
file 21.stream
21.stream: Microsoft ICM Color Profile
Looks like we succeeded. :-)
Step 5: Open the color profile
I'll see if my Mac OSX system does accept this profile:
mv 21.stream 21.icm
open 21.icm
OSX uses the 'Color Sync Utility' to open the file and display a window. Clicking on the list entries opens different information panes at the bottom of the window:
Step 6: Use Argyll's iccdump
to dump the contents of the ICC profile as text
Note, that Graeme Gill's ArgyllCMS, the open source color management software, available for Linux, Mac OSX and Windows, ships with a whole suite of command line tools. One of these is iccdump
. We can use it to look at the properties of the newly won 21.icm
file:
iccdump 21.icm icc: Header: size = 3144 bytes CMM = 'Lino' Version = 2.1.0 Device Class = Display Color Space = RGB Conn. Space = XYZ Date, Time = 9 Feb 1998, 6:49:00 Platform = Microsoft Flags = Not Embedded Profile, Use anywhere Dev. Mnfctr. = 'IEC ' Dev. Model = 'sRGB' Dev. Attrbts = Reflective, Glossy Rndrng Intnt = Perceptual Illuminant = 0.964203, 1.000000, 0.824905 [Lab 100.000000, 0.000498, -0.000436] Creator = 'HP ' tag 0: sig 'cprt' type 'text' offset 336 size 51 Text: No. chars = 43 0x0000: Copyright (c) 1998 Hewlett-Packard Company tag 1: sig 'desc' type 'desc' offset 388 size 108 TextDescription: ASCII data, length 18 chars: 0x0000: sRGB IEC61966-2.1 No Unicode data ScriptCode Data, Code 0x0, length 18 chars 0x0000: 73 52 47 42 20 49 45 43 36 31 39 36 36 2d 32 2e 31 00 tag 2: sig 'wtpt' type 'XYZ ' offset 496 size 20 XYZArray: No. elements = 1 tag 3: sig 'bkpt' type 'XYZ ' offset 516 size 20 XYZArray: No. elements = 1 tag 4: sig 'rXYZ' type 'XYZ ' offset 536 size 20 XYZArray: No. elements = 1 tag 5: sig 'gXYZ' type 'XYZ ' offset 556 size 20 XYZArray: No. elements = 1 tag 6: sig 'bXYZ' type 'XYZ ' offset 576 size 20 XYZArray: No. elements = 1 tag 7: sig 'dmnd' type 'desc' offset 596 size 112 TextDescription: ASCII data, length 22 chars: 0x0000: IEC http://www.iec.ch No Unicode data ScriptCode Data, Code 0x0, length 22 chars 0x0000: 49 45 43 20 68 74 74 70 3a 2f 2f 77 77 77 2e 69 65 63 2e 63 68 00 tag 8: sig 'dmdd' type 'desc' offset 708 size 136 TextDescription: ASCII data, length 46 chars: 0x0000: IEC 61966-2.1 Default RGB colour space - sRGB No Unicode data ScriptCode Data, Code 0x0, length 46 chars 0x0000: 49 45 43 20 36 31 39 36 36 2d 32 2e 31 20 44 65 66 61 75 6c 74 20 ... tag 9: sig 'vued' type 'desc' offset 844 size 134 TextDescription: ASCII data, length 44 chars: 0x0000: Reference Viewing Condition in IEC61966-2.1 No Unicode data ScriptCode Data, Code 0x0, length 44 chars 0x0000: 52 65 66 65 72 65 6e 63 65 20 56 69 65 77 69 6e 67 20 43 6f 6e 64 ... tag 10: sig 'view' type 'view' offset 980 size 36 Viewing Conditions: XYZ value of illuminant in cd/m^2 = 19.644501, 20.371796, 16.808899 XYZ value of surround in cd/m^2 = 3.928894, 4.074387, 3.361786 Illuminant type = D50 tag 11: sig 'lumi' type 'XYZ ' offset 1016 size 20 XYZArray: No. elements = 1 tag 12: sig 'meas' type 'meas' offset 1036 size 36 Measurement: Standard Observer = 1931 Two Degrees XYZ for Measurement Backing = 0.000000, 0.000000, 0.000000 [Lab 0.000000, 0.000000, 0.000000] Measurement Geometry = Unknown Measurement Flare = 1.0% Standard Illuminant = D65 tag 13: sig 'tech' type 'sig ' offset 1072 size 12 Signature Technology = Cathode Ray Tube Display tag 14: sig 'rTRC' type 'curv' offset 1084 size 2060 Curve: No. elements = 1024 tag 15: sig 'gTRC' type 'curv' offset 1084 size 2060 Curve: No. elements = 1024 tag 16: sig 'bTRC' type 'curv' offset 1084 size 2060 Curve: No. elements = 1024
P.S.:
ArgyllCMS contains a command line tool, extracticc
, which can extract an embedded ICC profile from a TIFF file. It does not have a tool to extract a profile from a PDF file.
这篇关于如何转储PDF中的嵌入式ICC配置文件信息? (命令行或GUI工具)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!