Skip to content

image/png: DecodeConfig sometimes returns a palette, sometimes not #4279

@gopherbot

Description

@gopherbot

by jsummers3456:

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions