Identify -verbose thinks thinks file is in Gray colorspace

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
jmcnevin
Posts: 1
Joined: 2013-11-05T13:07:51-07:00
Authentication code: 6789

Identify -verbose thinks thinks file is in Gray colorspace

Post by jmcnevin »

Hi all. I'm having a strange issue trying to determine the colorspace of an image.

Given the following command:

identify -quiet -ping -format "%[colorspace]" cover_front.jpg
"sRGB" is returned.

But, if I use -verbose:

Image: cover_front.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Mime type: image/jpeg
Class: DirectClass
Geometry: 1500x2400+0+0
Units: Undefined
Type: Grayscale
Endianess: Undefined
Colorspace: Gray
...

Now, this only seems to happen if the JPEG in question just doesn't happen to contain any color.

This is happening with IM 6.8.7-0. The file I'm using can be found here: https://www.dropbox.com/s/eofm1jzgjvc8l ... _front.jpg.

Am I doing something wrong here?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Identify -verbose thinks thinks file is in Gray colorspa

Post by magick »

JPEG encodes the colorspace. For your image, it returns JCS_RGB rather than JCS_GRAYSCALE. With -verbose, ImageMagick analyzes the image and determines its actually grayscale rather than sRGB.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Identify -verbose thinks thinks file is in Gray colorspa

Post by fmw42 »

try

Code: Select all

identify -quiet -ping -format "%[type]" cover_front.jpg
Post Reply