Skip to content

Allow for different palette entry sizes when correcting BMP pixel data offset#9472

Open
radarhere wants to merge 3 commits intopython-pillow:mainfrom
radarhere:bmp
Open

Allow for different palette entry sizes when correcting BMP pixel data offset#9472
radarhere wants to merge 3 commits intopython-pillow:mainfrom
radarhere:bmp

Conversation

@radarhere
Copy link
Member

Resolves #9466

#5899 allowed for a scenario where the offset to the image data in a BMP image didn't include the size of the palette. The PR added 4 bytes for each palette entry to compensate.

However, it turns out that each palette entry does not always use 4 bytes - https://en.wikipedia.org/wiki/BMP_file_format#Color_table

The colors in the color table are usually specified in the 4-byte per entry ARGB32 format. The color table used with the OS/2 BITMAPCOREHEADER uses the 3-byte per entry RGB24 format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BITMAPCOREHEADER DIB resources decoded incorrectly (wrong color table stride, wrong row stride for 1-bit)

1 participant