mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
commit
1f74704d6f
BIN
Tests/images/rgb32bf-abgr.bmp
Normal file
BIN
Tests/images/rgb32bf-abgr.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
|
@ -129,6 +129,13 @@ def test_rgba_bitfields():
|
|||
|
||||
assert_image_equal_tofile(im, "Tests/images/bmp/q/rgb32bf-xbgr.bmp")
|
||||
|
||||
# This test image has been manually hexedited
|
||||
# to change the bitfield compression in the header from XBGR to ABGR
|
||||
with Image.open("Tests/images/rgb32bf-abgr.bmp") as im:
|
||||
assert_image_equal_tofile(
|
||||
im.convert("RGB"), "Tests/images/bmp/q/rgb32bf-xbgr.bmp"
|
||||
)
|
||||
|
||||
|
||||
def test_rle8():
|
||||
with Image.open("Tests/images/hopper_rle8.bmp") as im:
|
||||
|
|
|
@ -172,10 +172,11 @@ class BmpImageFile(ImageFile.ImageFile):
|
|||
SUPPORTED = {
|
||||
32: [
|
||||
(0xFF0000, 0xFF00, 0xFF, 0x0),
|
||||
(0xFF0000, 0xFF00, 0xFF, 0xFF000000),
|
||||
(0xFF, 0xFF00, 0xFF0000, 0xFF000000),
|
||||
(0x0, 0x0, 0x0, 0x0),
|
||||
(0xFF000000, 0xFF0000, 0xFF00, 0x0),
|
||||
(0xFF000000, 0xFF0000, 0xFF00, 0xFF),
|
||||
(0xFF, 0xFF00, 0xFF0000, 0xFF000000),
|
||||
(0xFF0000, 0xFF00, 0xFF, 0xFF000000),
|
||||
(0x0, 0x0, 0x0, 0x0),
|
||||
],
|
||||
24: [(0xFF0000, 0xFF00, 0xFF)],
|
||||
16: [(0xF800, 0x7E0, 0x1F), (0x7C00, 0x3E0, 0x1F)],
|
||||
|
@ -183,6 +184,7 @@ class BmpImageFile(ImageFile.ImageFile):
|
|||
MASK_MODES = {
|
||||
(32, (0xFF0000, 0xFF00, 0xFF, 0x0)): "BGRX",
|
||||
(32, (0xFF000000, 0xFF0000, 0xFF00, 0x0)): "XBGR",
|
||||
(32, (0xFF000000, 0xFF0000, 0xFF00, 0xFF)): "ABGR",
|
||||
(32, (0xFF, 0xFF00, 0xFF0000, 0xFF000000)): "RGBA",
|
||||
(32, (0xFF0000, 0xFF00, 0xFF, 0xFF000000)): "BGRA",
|
||||
(32, (0x0, 0x0, 0x0, 0x0)): "BGRA",
|
||||
|
|
Loading…
Reference in New Issue
Block a user