我正在将图像从RGB转换为CMYK。如何从Linux命令行判断我的映像是否为CMYK?
我正在将图像从RGB转换为CMYK。如何从Linux命令行判断我的映像是否为CMYK?
Answers:
获取此信息的简单方法是使用ImageMagick软件包的identify
命令,请尝试:
$ identify -format '%[colorspace]' image.jpg
identify
是ImageMagick工具集的一部分。
$ identify -verbose foo.jpg | grep Colorspace
Colorspace: CMYK
$ identify -verbose foo.jpg
Image: foo.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Class: DirectClass
Geometry: 3872x2592+0+0
Resolution: 72x72
Print size: 53.7778x36
Units: PixelsPerInch
Type: ColorSeparation
Endianess: Undefined
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: 255 (1)
mean: 65.169 (0.255565)
standard deviation: 57.6369 (0.226027)
kurtosis: 0.308901
skewness: 1.17232
Magenta:
min: 0 (0)
max: 255 (1)
mean: 67.0774 (0.263049)
standard deviation: 47.216 (0.185161)
kurtosis: 1.37996
skewness: 0.914289
Yellow:
min: 0 (0)
max: 255 (1)
mean: 117.456 (0.46061)
standard deviation: 70.6394 (0.277017)
kurtosis: -1.07218
skewness: -0.180885
Black:
min: 0 (0)
max: 239 (0.937255)
mean: 40.826 (0.160102)
standard deviation: 49.258 (0.193168)
kurtosis: 1.56001
skewness: 1.50352
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 58.1056 (0.227865)
standard deviation: 63.7107 (0.249846)
kurtosis: 0.0487218
skewness: 1.03517
Total ink density: 331%
Rendering intent: Undefined
Interlace: None
Background color: white
Border color: cmyk(223,223,223,0)
Matte color: grey74
Transparent color: black
Compose: Over
Page geometry: 3872x2592+0+0
Dispose: Undefined
Iterations: 0
Compression: JPEG
Quality: 80
Orientation: Undefined
Properties:
date:create: 2011-12-23T13:00:23+00:00
date:modify: 2011-12-23T13:00:23+00:00
jpeg:colorspace: 4
jpeg:sampling-factor: 2x2,1x1,1x1,1x1
signature: 972c47bd4a83e6561f2ddd65c2a5ca217ea06955814815bfb9d35ccd6b83fec2
Profiles:
Profile-icc: 1829040 bytes
ISO Coated v2 (ECI)
Artifacts:
verbose: true
Tainted: False
Filesize: 3.968MB
Number pixels: 10.04MB
Pixels per second: 21.35MB
User time: 0.460u
Elapsed time: 0:01.469
Version: ImageMagick 6.6.0-4 2010-10-20 Q16 http://www.imagemagick.org
在Mac OS X上,您可以使用
sips -g space <filename>
例:
$ sips -g space file.jpg
/path/to/file.jpg
space: RGB
或者,仅打印相关信息:
$ sips -g space file.jpg | tail -n1 | awk '{print $2}'
RGB
我能够用Perl的Image :: Info库做到这一点。这是我在命令行上使用的一种衬板:
perl -MImage::Info -E 'say Image::Info::image_info("foo.jpg")->{color_type};'
(显然,这要求您已经安装了该库。)