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

Ensure that BMP pixel data offset does not ignore palette #5899

merged 1 commit into from Dec 28, 2021


Copy link

Resolves #5246

The BMP image in that issue has offset (PixelDataOffset in the linked documentation) to the image data of 54, ignoring the palette.

We also need to adjust PixelDataOffset the value accordingly by considering the size of the Color Pallet block.

So I think this is a mistake. This PR tolerates that though, by adding the palette size to the offset, if the offset is just the total size of the header.

The documentation states that the size of palette block is

In nutshell, the total size of this block is 4 x N bytes where N is the total entries in the color pallet.

@radarhere radarhere added the BMP label Dec 21, 2021
@hugovk hugovk merged commit fccc261 into python-pillow:main Dec 28, 2021
@radarhere radarhere deleted the bmp branch December 28, 2021 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

Strange image shift in .bmp files
2 participants