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

Added USE_RAW_ALPHA for BMP images #8602

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

radarhere
Copy link
Member

Resolves #8594

https://learn.microsoft.com/en-us/windows/win32/wmdm/-bitmapinfoheader describes 32 bitcount as

The bitmap has a maximum of 2^32 colors. If the biCompression member is BI_RGB, the bmiColors member is NULL. Each DWORD in the bitmap array represents the relative intensities of blue, green, and red, respectively, for a pixel. The high byte in each DWORD is not used.

where BI_RGB is what we call RAW compression. It is saying that the fourth channel is unused, as Pillow currently treats it as such for DIB images.

However, the issue has found that some images do not follow the documentation and store alpha data in the fourth channel anyway.

Because this is not the documented behaviour, it seems possible that using it anyway could introduce problems. If the user thinks that their images are in this form though, then I've added a USE_RAW_ALPHA setting that can be enabled.

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.

BmpImagePlugin - Unsupported 32bpp DIBs with Alpha
1 participant