Page 1 of 1

potential bug in colorspace in verbose info IM 6.4.7-0

Posted: 2008-12-05T13:30:08-07:00
by fmw42
IM 6.4.7-0 Q16 Mac OSX Tiger

I am not sure of this, but seems that long ago when getting the verbose information on an image, the colorspace item reported, RGB, Gray and CMYK for appropriate images. Am I mistaken. Today, I tested the following:

convert rose: -colorspace gray rose_gray.png
identify -verbose rose_gray.png

reports:
...
Type: Grayscale
Base type: Grayscale
Colorspace: RGB
Channel depth:
gray: 8-bit
Channel statistics:
gray:
min: 37 (0.145098)
max: 255 (1)
mean: 105.14 (0.412313)
standard deviation: 47.3907 (0.185846)
...


Likewise:

convert rose: -colorspace cmyk rose_cmyk.png
identify -verbose rose_cmyk.png

reports:
...
Type: TrueColor
Colorspace: RGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
Channel statistics:
red:
min: 35 (0.137255)
max: 255 (1)
mean: 145.712 (0.57142)
standard deviation: 69.2953 (0.271746)
green:
min: 22 (0.0862745)
max: 255 (1)
mean: 89.2602 (0.35004)
standard deviation: 52.4698 (0.205764)
blue:
min: 24 (0.0941176)
max: 255 (1)
mean: 80.4683 (0.315562)
standard deviation: 55.1114 (0.216123)

Also

convert rose_cmyk.png -format "%[colorspace]" info:
RGB


Am I wrong, but should not the colorspace be properly reported for Gray and CMYK. Also should not the statistics for CMYK show C,M,Y,K values and not RGB values.

Am I doing something wrong?

Re: potential bug in colorspace in verbose info IM 6.4.7-0

Posted: 2008-12-05T13:55:38-07:00
by magick
PNG does not support CMYK or the Grayscale colorspace so its auto-converted to RGB.

Re: potential bug in colorspace in verbose info IM 6.4.7-0

Posted: 2008-12-05T16:41:59-07:00
by fmw42
magick wrote:PNG does not support CMYK or the Grayscale colorspace so its auto-converted to RGB.
OK. So what image types support colorspace=gray. I have tried JPG, GIF and PSD besides PNG

convert rose: -colorspace gray rose_gray.jpg
identify -verbose rose_gray.jpg
...
Colorspace: RGB
...


convert rose: -colorspace gray rose_gray.gif
identify -verbose rose_gray.gif
...
Colorspace: RGB
...


convert rose: -colorspace gray rose_gray.psd
identify -verbose rose_gray.psd
...
Colorspace: RGB
...

The all say, Type=Grayscale, which is fine, but I know at one time in the past, verbose info was reporting Colorspace=Gray as many if my scripts were testing that way. If necessary, I can switch to testing for either Type=Grayscale or Colospace=Gray. I just would like to understand what to expect.

Thanks.

Fred

Re: potential bug in colorspace in verbose info IM 6.4.7-0

Posted: 2008-12-05T18:47:05-07:00
by magick
The only formats that support colorspace = gray is MIFF and MPC. The proper attribute to distinquish a grayscale image is the image type.

Re: potential bug in colorspace in verbose info IM 6.4.7-0

Posted: 2008-12-05T19:00:48-07:00
by fmw42
magick wrote:The only formats that support colorspace = gray is MIFF and MPC. The proper attribute to distinquish a grayscale image is the image type.

Thanks. I appreciate the information and will change my scripts accordingly as needed.

I assume as this works to give me gray, that it must be actually checking the image type rather than the colorspace. This is then very useful.

convert rose_gray.jpg -format "%[colorspace]" info:
Gray

(for IM 6.3.9-2 or higher)