How can I tell if my image is CMYK from Linux command line?
I'm converting images from RGB to CMYK. How can I tell if my image is CMYK from the Linux command line?
The simple way to get this info is by using identify
command of the ImageMagick Package, try:
$ identify -format '%[colorspace]' image.jpg
identify
is part of the ImageMagick toolset.
$ 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
On Mac OS X, you can use
sips -g space <filename>
Example:
$ sips -g space file.jpg
/path/to/file.jpg
space: RGB
Or, only printing the relevant information:
$ sips -g space file.jpg | tail -n1 | awk '{print $2}'
RGB