Starting with IM-6.7.6-10 (SVN revision 7885), the PNG decoder is overriding any gAMA, cHRM,
and sRGB chunk data for grayscale images. I have added a comment to this effect in coders/png.c,
but I think that instead it should be using a default gamma=1.0 and rendering_intent=Undefined for
grayscale images but should use the data from any PNG ancillary chunks. At this moment I don't
think any iCCP chunk data found in a grayscale image is ignored/reset.
Edit: in SVN revision 7920 I checked in a change to IM-6.7.6-10 to retain the gAMA,
cHRM, and sRGB data found in grayscale PNG input, but to continue to reset gamma
to 1.0 and undefine chromaticity and rendering intent if no gAMA, cHRM, or sRGB
chunk is present. If the other developers think this is OK then I'll revise IM-7.0 too.
Colorspace info is now ignored in grayscale PNG images
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Colorspace info is now ignored in grayscale PNG images
Any changes in IMv6, should also be made to IMv7. The opposite however is not always true
As mentioned I added to both. -set gamma and %[gamma] to set and report the 'gamma' setting.
Note that -set gamma should be used in preference to +gamma (which I never documented or used in IM examples as it never made much sense with -gamma being an operator!
In IMv7 I will later be making +gamma a 'undo gamma' or -gamma 1/value type operation. Something that has been 'missing' from the various other gamma corrected resize examples.
NOTE: the gamma meta-data stored in the image seems to be the 'gamma' needed to undo the gamma that is present in the image, rather that the 'gamma' that has been applied to the image. That is a sRGB image has a 'gamma' of roughly '0.45454'.
Is this correct and consistant? I would assume so.
As mentioned I added to both. -set gamma and %[gamma] to set and report the 'gamma' setting.
Note that -set gamma should be used in preference to +gamma (which I never documented or used in IM examples as it never made much sense with -gamma being an operator!
In IMv7 I will later be making +gamma a 'undo gamma' or -gamma 1/value type operation. Something that has been 'missing' from the various other gamma corrected resize examples.
NOTE: the gamma meta-data stored in the image seems to be the 'gamma' needed to undo the gamma that is present in the image, rather that the 'gamma' that has been applied to the image. That is a sRGB image has a 'gamma' of roughly '0.45454'.
Is this correct and consistant? I would assume so.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Colorspace info is now ignored in grayscale PNG images
I believe that it has now been fixed in the latest 6.7.6.10 beta. I get now:
convert rose: -colorspace gray roseg.png
verbose info:
Image: roseg.png
Format: PNG (Portable Network Graphics)
Class: PseudoClass
Geometry: 70x46+0+0
Resolution: 72x72
Print size: 0.972222x0.638889
Units: Undefined
Type: Grayscale
Base type: Grayscale
Endianess: Undefined
Colorspace: Gray
Depth: 8-bit
Channel depth:
gray: 8-bit
...
Rendering intent: Undefined
Gamma: 1
Interlace: None
Background color: gray(255,255,255)
Border color: gray(223,223,223)
Matte color: gray(189,189,189)
Transparent color: gray(0,0,0)
Compose: Over
Page geometry: 70x46+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Properties:
date:create: 2012-05-14T20:24:07-07:00
date:modify: 2012-05-14T20:24:07-07:00
png:bKGD : chunk was found (see Background color, above)
png:cHRM : chunk was found (see Chromaticity, above)
png:gAMA : gamma=0.45454544 (See Gamma, above)
png:IHDR.bit_depth : 8
png:IHDR.color_type : 0
png:IHDR.interlace_method: 0
png:IHDR.width,height : 70, 46
png:pHYs : x_res=72, y_res=72, units=0
png:sRGB : intent=0 (See Rendering intent)
png:text : 2 tEXt/zTXt/iTXt chunks were found
convert rose: -colorspace gray roseg.png
verbose info:
Image: roseg.png
Format: PNG (Portable Network Graphics)
Class: PseudoClass
Geometry: 70x46+0+0
Resolution: 72x72
Print size: 0.972222x0.638889
Units: Undefined
Type: Grayscale
Base type: Grayscale
Endianess: Undefined
Colorspace: Gray
Depth: 8-bit
Channel depth:
gray: 8-bit
...
Rendering intent: Undefined
Gamma: 1
Interlace: None
Background color: gray(255,255,255)
Border color: gray(223,223,223)
Matte color: gray(189,189,189)
Transparent color: gray(0,0,0)
Compose: Over
Page geometry: 70x46+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Properties:
date:create: 2012-05-14T20:24:07-07:00
date:modify: 2012-05-14T20:24:07-07:00
png:bKGD : chunk was found (see Background color, above)
png:cHRM : chunk was found (see Chromaticity, above)
png:gAMA : gamma=0.45454544 (See Gamma, above)
png:IHDR.bit_depth : 8
png:IHDR.color_type : 0
png:IHDR.interlace_method: 0
png:IHDR.width,height : 70, 46
png:pHYs : x_res=72, y_res=72, units=0
png:sRGB : intent=0 (See Rendering intent)
png:text : 2 tEXt/zTXt/iTXt chunks were found