Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm converting images from RGB to CMYK. How can I tell if my image is CMYK from the Linux command line?

share|improve this question
add comment

4 Answers

The simple way to get this info is by using identify command of the ImageMagick Package, try:

$ identify -format '%[colorspace]' image.jpg
share|improve this answer
add comment

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
share|improve this answer
    
Thanks! I'm on Ubuntu. I dont see sips in the apt repository. –  Eric Johnson Dec 23 '11 at 15:01
    
@EricJohnson Ubuntu is not a Unix. Mac OS X is, though. I'll keep this answer up, it might help others. –  Daniel Beck Dec 23 '11 at 15:04
    
Just to preempt downvotes: When I originally posted this answer, the question was very different and this answer was appropriate. –  Daniel Beck Dec 24 '11 at 19:40
add comment

I was able to do it with Perl's Image::Info library. Here is the one liner I used on the command line:

perl -MImage::Info -E 'say Image::Info::image_info("foo.jpg")->{color_type};'

(Obviously this requires that you have the library installed already. )

share|improve this answer
add comment

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
share|improve this answer
    
+1 As this method gives new users an impression what other info might be queried with identify. –  math Apr 29 '13 at 12:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.