如果要將ImageMagick的identify
識別爲CMYK,那麼我有很多麻煩。將PDF轉換爲CMYK(具有識別CMYK的識別碼)
本質,讓我們說我建立這個文件,test.tex
,與pdflatex
:
\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,這將由identify
被確認爲CMYK - 但沒有運氣,即使有:
$ 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
...
因此identify
認爲是唯一改變的是(來自之前的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,這將是identify
版爲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
(雖然,黑色將是豐富的,不平原 - 在所有四個頻道);然而,這個命令將工作只有當幻燈片添加圖像(顯然,它是一個觸發顏色轉換?!)!有趣的是,我無法從pdflatex
PDF中獲得同樣的效果。
所以我想我的問題都可以問兩種方式:
- 是否有在Linux的任何命令行轉換方法,將同時保留矢量的RGB PDF轉換成CMYK PDF ,它在
identify
中被識別爲這樣(並且因此將構建CMYK顏色的正確直方圖) - 是否有任何其他與
identify
類似的命令行Linux工具,即使在原始0中也可以正確識別CMYK顏色的使用frompdflatex
(並可能建立一個顏色直方圖,基於任意選擇的PDF頁面,如identify
應該是)?
預先感謝任何答案,
乾杯!
一些參考:
- adobe - Script (or some other means) to convert RGB to CMYK in PDF? - Stack Overflow
- color - PDF colour model and LaTeX - TeX - LaTeX - Stack Exchange
- color - Option cmyk for xcolor package does not produce a CMYK PDF - TeX - LaTeX - Stack Exchange
- Making a cmyk PDF - comp.text.tex | Computer Group
- colormanagement with ghostscript ? - Rhinocerus:
它是否指定爲「0 0 0 1 setcmykcolor」?或者可能更像是「0 0 0 setrgbcolor」?在 後一種情況下,如果DeviceRGB爲 ,則會重新映射到基於CIE的色彩空間,以便獲得RGB圖像顏色 的管理權限。
用來捕獲非常感謝,@pipitas - 還沒有考出你的命令的時間,但它看起來很有道理,所以我在這裏設置的接受現在...乾杯! – sdaau 2012-02-03 08:53:02
我發現使用給定的命令會將JPEG製品添加到我的圖像中。添加'-dEncodeColorImages = false'可以防止這種情況發生,同時仍然可以轉換顏色。有關非顏色變體,請參見[源代碼](http://superuser.com/questions/360216/use-ghostscript-but-tell-it-to-not-reprocess-images)。 – Marein 2015-05-28 12:25:35
@Marein:感謝您的評論 - 我已將其內容包含在我的答案更新中。 – 2015-05-28 12:53:57