mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Merge pull request #2221 from jmerdich/master
Add support for another type of BMP bitfield
This commit is contained in:
commit
8c36cd09f7
|
@ -136,12 +136,13 @@ class BmpImageFile(ImageFile.ImageFile):
|
|||
# ----------------- Process BMP with Bitfields compression (not palette)
|
||||
if file_info['compression'] == self.BITFIELDS:
|
||||
SUPPORTED = {
|
||||
32: [(0xff0000, 0xff00, 0xff, 0x0), (0xff0000, 0xff00, 0xff, 0xff000000), (0x0, 0x0, 0x0, 0x0)],
|
||||
32: [(0xff0000, 0xff00, 0xff, 0x0), (0xff0000, 0xff00, 0xff, 0xff000000), (0x0, 0x0, 0x0, 0x0), (0xff000000, 0xff0000, 0xff00, 0x0) ],
|
||||
24: [(0xff0000, 0xff00, 0xff)],
|
||||
16: [(0xf800, 0x7e0, 0x1f), (0x7c00, 0x3e0, 0x1f)]
|
||||
}
|
||||
MASK_MODES = {
|
||||
(32, (0xff0000, 0xff00, 0xff, 0x0)): "BGRX",
|
||||
(32, (0xff000000, 0xff0000, 0xff00, 0x0)): "XBGR",
|
||||
(32, (0xff0000, 0xff00, 0xff, 0xff000000)): "BGRA",
|
||||
(32, (0x0, 0x0, 0x0, 0x0)): "BGRA",
|
||||
(24, (0xff0000, 0xff00, 0xff)): "BGR",
|
||||
|
|
BIN
Tests/images/bmp/q/rgb32bf-xbgr.bmp
Normal file
BIN
Tests/images/bmp/q/rgb32bf-xbgr.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
|
@ -26,12 +26,26 @@ class TestBmpReference(PillowTestCase):
|
|||
def test_questionable(self):
|
||||
""" These shouldn't crash/dos, but it's not well defined that these
|
||||
are in spec """
|
||||
supported = [
|
||||
"pal8os2v2.bmp",
|
||||
"rgb24prof.bmp",
|
||||
"pal1p1.bmp",
|
||||
"pal8offs.bmp",
|
||||
"rgb24lprof.bmp",
|
||||
"rgb32fakealpha.bmp",
|
||||
"rgb24largepal.bmp",
|
||||
"pal8os2sp.bmp",
|
||||
"rgb32bf-xbgr.bmp",
|
||||
]
|
||||
for f in self.get_files('q'):
|
||||
try:
|
||||
im = Image.open(f)
|
||||
im.load()
|
||||
if os.path.basename(f) not in supported:
|
||||
print("Please add %s to the partially supported bmp specs." % f)
|
||||
except Exception: # as msg:
|
||||
pass
|
||||
if os.path.basename(f) in supported:
|
||||
raise
|
||||
# print ("Bad Image %s: %s" %(f,msg))
|
||||
|
||||
def test_good(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user