Set color table fourth channel to zero for 1 and L mode when saving BMP by radarhere · Pull Request #8889 · python-pillow/Pillow

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

@radarhere

Copy link Copy Markdown

Member

@radarhere radarhere commented

Apr 13, 2025

edited

Loading

Resolves #8888

https://www.ece.ualberta.ca/~elliott/ee552/studentAppNotes/2003_w/misc/bmp_file_format/bmp_file_format.htm states that the fourth channel in a BMP color table is 'unused (=0)'.

It seems reasonable to do so when saving 1 and L mode BMPs, and makes more intuitive sense than our current strategy of setting the fourth channel to the same value as the other three.

@hugovk hugovk merged commit ba37249 into python-pillow:main

Jun 27, 2025

56 of 58 checks passed

@radarhere radarhere deleted the bmp branch

June 27, 2025 15:17

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

BmpImagePlugin save palette (in "1" mode) sets a "should probably be 0" value to 255...

2 participants

@radarhere @hugovk