我正在将图像从 RGB 转换为 CMYK。如何从 Linux 命令行判断我的图像是否为 CMYK?
答案1
答案2
identify
是图像魔术师工具集。
$ 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
答案3
在 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
答案4
我可以用 Perl 的图片::信息库。下面是我在命令行上使用的一行代码:
perl -MImage::Info -E 'say Image::Info::image_info("foo.jpg")->{color_type};'
(显然这要求您已经安装了该库。)