Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gopherbot opened this issue Oct 23, 2012 · 7 comments
Closed

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

gopherbot opened this issue Oct 23, 2012 · 7 comments
Milestone

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Oct 23, 2012

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
@griesemer
Copy link
Contributor

@griesemer griesemer commented Nov 1, 2012

Comment 1:

Owner changed to @nigeltao.

@nigeltao
Copy link
Contributor

@nigeltao nigeltao commented Nov 5, 2012

Comment 2:

That play.golang.org program gives the raw bytes; can you describe how that test image
was generated?
@rsc
Copy link
Contributor

@rsc rsc commented Dec 10, 2012

Comment 3:

Labels changed: added size-m.

@rsc
Copy link
Contributor

@rsc rsc commented Dec 30, 2012

Comment 4:

Labels changed: added priority-later, removed priority-triage.

Status changed to Accepted.

@vdobler
Copy link
Contributor

@vdobler vdobler commented Feb 28, 2013

Comment 5:

I admit I have some problems understanding this issue:
What is wrong with the alpha values? Why is 0xFFFF as 
returned by RGBA not the right value?
@vdobler
Copy link
Contributor

@vdobler vdobler commented Feb 28, 2013

Comment 6:

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.
@nigeltao
Copy link
Contributor

@nigeltao nigeltao commented Mar 4, 2013

Comment 7:

This issue was closed by revision 9d6e027.

Status changed to Fixed.

@gopherbot gopherbot added fixed labels Mar 4, 2013
@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.