What steps will reproduce the problem?
1. Import image/png
2. Attempt to use image.Decode() on certain PNG files
3. Observe error message
Code example (and image) - http://play.golang.org/p/cfi12UMcMR
What is the expected output?
What do you see instead?
2012/10/31 01:59:54 png: invalid format: palette index out of range
exit status 1
Which compiler are you using (5g, 6g, 8g, gccgo)?
Which operating system are you using?
Which version are you using? (run 'go version')
Please provide any additional information below.
The image attached is an example of error-inducing data. It opens fine in software like
Firefox, Chrome and IrfanView, so it would be nice to make it usable in Go as well.
That's a pretty sad approach. Suppose someone in the future wanted to write an image
editor. Should they just throw away a ton of possible openable images simply because Go
can't be bothered to parse them? At least make an alternative "MustDecode" version or
then how do we draw the line between acceptable and unacceptable images?
there will be tons of type of invalid images, how should we treat them?
i argue that whatever we do with them, the user needs a control, and that
unnecessarily complicates the API.
i think if you want to write an image editor, and specifically want to deal with
bad images, you definitely should apply an extra correction step to them
before feeding them to the image package.
that said, if we provide an API to retrieve the metadata of an image without
parsing them, we can accept images with this kind of defeats.
will let nigel to decide.