potential bug in colorspace in verbose info IM 6.4.7-0

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

potential bug in colorspace in verbose info IM 6.4.7-0

Post 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?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post by magick »

PNG does not support CMYK or the Grayscale colorspace so its auto-converted to RGB.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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)
Post Reply