mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 01:16:16 +03:00
Add support for bitmaps with header size 56
Size 56 is the undocumented `BITMAPV3INFOHEADER`. It adds the alpha bit mask. The format is known to be supported by: - Windows (MS paint, etc.) - Adobe Photoshop - Popular web browsers
This commit is contained in:
parent
2f3281dcda
commit
a1a2202ebe
BIN
Tests/images/bmp/q/rgba32h56.bmp
Normal file
BIN
Tests/images/bmp/q/rgba32h56.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
|
@ -45,6 +45,7 @@ def test_questionable() -> None:
|
|||
"pal8rletrns.bmp",
|
||||
"rgb32bf-xbgr.bmp",
|
||||
"rgb32h52.bmp",
|
||||
"rgba32h56.bmp",
|
||||
]
|
||||
for f in get_files("q"):
|
||||
try:
|
||||
|
|
|
@ -53,7 +53,7 @@ def _accept(prefix: bytes) -> bool:
|
|||
|
||||
|
||||
def _dib_accept(prefix):
|
||||
return i32(prefix) in [12, 40, 52, 64, 108, 124]
|
||||
return i32(prefix) in [12, 40, 52, 56, 64, 108, 124]
|
||||
|
||||
|
||||
# =============================================================================
|
||||
|
@ -95,7 +95,7 @@ class BmpImageFile(ImageFile.ImageFile):
|
|||
|
||||
# --------------------------------------------- Windows Bitmap v2 to v5
|
||||
# v3, OS/2 v2, v4, v5
|
||||
elif file_info["header_size"] in (40, 52, 64, 108, 124):
|
||||
elif file_info["header_size"] in (40, 52, 56, 64, 108, 124):
|
||||
file_info["y_flip"] = header_data[7] == 0xFF
|
||||
file_info["direction"] = 1 if file_info["y_flip"] else -1
|
||||
file_info["width"] = i32(header_data, 0)
|
||||
|
|
Loading…
Reference in New Issue
Block a user