2

I want to get colormode (bitmap, gray, rgb, cmyk) of image files (jpg, tif). Imagemagick calls it "colorspace", while exiftool "colormode" and Photoshop "image mode".

One possibility is identify, which gives nearly always the desired result, but it is painfully slow. Identify has also a problem, it identifies monochrome images (Bitmap) as Gray.

// Version: ImageMagick 6.5.4-7 2012-05-07 Q16 OpenMP http://www.imagemagick.org
time identify -quiet -ping -format "%[colorspace] %f\n" *.jpg *.tif
real    0m9.479s
user    0m1.202s
sys 0m8.232s

exiftool is faster (and detects monochromes as "Bitmap" which is correct), but does not always give the colorspace at all:

//ExifTool Version Number         : 9.24
time exiftool -S -ColorMode *.jpg *.tif
real    0m1.178s
user    0m1.098s
sys 0m0.071s

Is it possible to get always the colormode using exiftool, or some other fast way?

Timo Kähkönen
  • 11,962
  • 9
  • 71
  • 112

1 Answers1

1

Phil Harvey (Exiftool author) writes in quite a few threads on his forum that ExifTool "shows you what's there." Andreas Huggel's Exiv2 does likewise. I think ImageMagick, if it can't find color mode metadata, approximates it from different elements in the code of the file. It follows, then, that IM is slower because, likely as not, it's taking the time to do the approximations. Eye of Gnome in GNOME 2 shows an "Error: -65535" in its GUI when there's no color mode data in a file, which used to annoy me till I found out how to change it (i.e, with either Exiv2 or IM).

I don't know that there Is a command-line app or utility that will read or approximate a picture's color mode differently from the two you're already using. (And in "differently" please read "faster or better.")

BZT