mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-16 03:20:53 +03:00
use new rawmodes in BMP and TGA image plugins
This commit is contained in:
parent
5ffaf3f378
commit
f281063941
|
@ -85,7 +85,7 @@ def test_rgba_16() -> None:
|
||||||
with Image.open("Tests/images/rgba16.tga") as im:
|
with Image.open("Tests/images/rgba16.tga") as im:
|
||||||
assert im.mode == "RGBA"
|
assert im.mode == "RGBA"
|
||||||
|
|
||||||
assert im.getpixel((0, 0)) == (172, 0, 255, 255)
|
assert im.getpixel((0, 0)) == (173, 0, 255, 255)
|
||||||
assert im.getpixel((1, 0)) == (0, 255, 82, 0)
|
assert im.getpixel((1, 0)) == (0, 255, 82, 0)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ BIT2MODE = {
|
||||||
1: ("P", "P;1"),
|
1: ("P", "P;1"),
|
||||||
4: ("P", "P;4"),
|
4: ("P", "P;4"),
|
||||||
8: ("P", "P"),
|
8: ("P", "P"),
|
||||||
16: ("RGB", "BGR;15"),
|
16: ("RGB", "XRGB;1555"),
|
||||||
24: ("RGB", "BGR"),
|
24: ("RGB", "BGR"),
|
||||||
32: ("RGB", "BGRX"),
|
32: ("RGB", "BGRX"),
|
||||||
}
|
}
|
||||||
|
@ -218,8 +218,8 @@ class BmpImageFile(ImageFile.ImageFile):
|
||||||
(32, (0xFF000000, 0xFF00, 0xFF, 0xFF0000)): "BGAR",
|
(32, (0xFF000000, 0xFF00, 0xFF, 0xFF0000)): "BGAR",
|
||||||
(32, (0x0, 0x0, 0x0, 0x0)): "BGRA",
|
(32, (0x0, 0x0, 0x0, 0x0)): "BGRA",
|
||||||
(24, (0xFF0000, 0xFF00, 0xFF)): "BGR",
|
(24, (0xFF0000, 0xFF00, 0xFF)): "BGR",
|
||||||
(16, (0xF800, 0x7E0, 0x1F)): "BGR;16",
|
(16, (0xF800, 0x7E0, 0x1F)): "RGB;565",
|
||||||
(16, (0x7C00, 0x3E0, 0x1F)): "BGR;15",
|
(16, (0x7C00, 0x3E0, 0x1F)): "XRGB;1555",
|
||||||
}
|
}
|
||||||
if file_info["bits"] in SUPPORTED:
|
if file_info["bits"] in SUPPORTED:
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -36,7 +36,7 @@ MODES = {
|
||||||
(3, 1): "1",
|
(3, 1): "1",
|
||||||
(3, 8): "L",
|
(3, 8): "L",
|
||||||
(3, 16): "LA",
|
(3, 16): "LA",
|
||||||
(2, 16): "BGRA;15Z",
|
(2, 16): "ARGB;1555Z",
|
||||||
(2, 24): "BGR",
|
(2, 24): "BGR",
|
||||||
(2, 32): "BGRA",
|
(2, 32): "BGRA",
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ class TgaImageFile(ImageFile.ImageFile):
|
||||||
start, size, mapdepth = i16(s, 3), i16(s, 5), s[7]
|
start, size, mapdepth = i16(s, 3), i16(s, 5), s[7]
|
||||||
if mapdepth == 16:
|
if mapdepth == 16:
|
||||||
self.palette = ImagePalette.raw(
|
self.palette = ImagePalette.raw(
|
||||||
"BGRA;15Z", bytes(2 * start) + self.fp.read(2 * size)
|
"ARGB;1555Z", bytes(2 * start) + self.fp.read(2 * size)
|
||||||
)
|
)
|
||||||
self.palette.mode = "RGBA"
|
self.palette.mode = "RGBA"
|
||||||
elif mapdepth == 24:
|
elif mapdepth == 24:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user