Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
image/png: DecodeConfig sometimes returns a palette, sometimes not #4279
For 8-bit paletted PNG images, DecodeConfig() returns a populated palette in the ColorModel field, though it lacks correct alpha values. For 1, 2, and 4-bit paletted PNG images, and GIF images, it returns a nil palette. Test case http://play.golang.org/p/3zMu7XFlQX Actual output: pal4: is paletted palette is nil pal8: is paletted palette size = 2 pal[ 0] = 65535, 0, 0,65535 pal[ 1] = 0,65535,65535,65535 Expected results: Whether DecodeConfig returns a populated palette should be consistent throughout the standard library. (I suggest that it never return a populated palette.) If a palette is returned, it should have correct alpha values. Compiler: 6g OS: Linux version: devel +8d919bfe75d3 Tue Oct 23 02:33:51 2012 +0800
But it is true, that reading the PLTE chunk is done for 8bit images only: http://tip.golang.org/src/pkg/image/png/reader.go?s=16273:16287#L634 This is inconsistent and I believe not backed by the spec.