x/image/bmp: support to decode 8-bit format with up to 256 color palette #61240
Labels
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I got
bmp: unsupported BMP image
when I tried to Decode the following image.Sample code:
What did you expect to see?
Decode success
What did you see instead?
Additional information
Current implementation of
reader.go
assumes that the number of palette is 256. Therefore,bmp: unsupported BMP image
occurs when the number of palette is not 256.I think that the number of palette should depend on
biClrUsed
ofBITMAPINFOHEADER
instead of fixing it to 256. Note that ifbiClrUsed
is 0, the number of palette is 2 to the power of bit per pixel (e.g. 256 colors for 8-bit format, 16 colors for 4-bit format).I will modify
reader.go
to support 8-bit format with up to 256 color palette.References:
The text was updated successfully, but these errors were encountered: