mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-03 11:35:52 +03:00
Merge pull request #5400 from radarhere/mapdepth_16
Changed mode for TGA 16-bit palette to BGR;15
This commit is contained in:
commit
fc08a72600
BIN
Tests/images/p_16.png
Normal file
BIN
Tests/images/p_16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 378 B |
BIN
Tests/images/p_16.tga
Normal file
BIN
Tests/images/p_16.tga
Normal file
Binary file not shown.
|
@ -65,6 +65,11 @@ def test_sanity(tmp_path):
|
||||||
roundtrip(original_im)
|
roundtrip(original_im)
|
||||||
|
|
||||||
|
|
||||||
|
def test_palette_depth_16():
|
||||||
|
with Image.open("Tests/images/p_16.tga") as im:
|
||||||
|
assert_image_equal_tofile(im.convert("RGB"), "Tests/images/p_16.png")
|
||||||
|
|
||||||
|
|
||||||
def test_id_field():
|
def test_id_field():
|
||||||
# tga file with id field
|
# tga file with id field
|
||||||
test_file = "Tests/images/tga_id_field.tga"
|
test_file = "Tests/images/tga_id_field.tga"
|
||||||
|
|
|
@ -113,7 +113,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(
|
||||||
"BGR;16", b"\0" * 2 * start + self.fp.read(2 * size)
|
"BGR;15", b"\0" * 2 * start + self.fp.read(2 * size)
|
||||||
)
|
)
|
||||||
elif mapdepth == 24:
|
elif mapdepth == 24:
|
||||||
self.palette = ImagePalette.raw(
|
self.palette = ImagePalette.raw(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user