mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Changed mode for 16-bit palette to BGR;15
This commit is contained in:
parent
356681faae
commit
fc64064387
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.
|
@ -6,7 +6,7 @@ import pytest
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from .helper import assert_image_equal, hopper
|
from .helper import assert_image_equal, assert_image_equal_tofile, hopper
|
||||||
|
|
||||||
_TGA_DIR = os.path.join("Tests", "images", "tga")
|
_TGA_DIR = os.path.join("Tests", "images", "tga")
|
||||||
_TGA_DIR_COMMON = os.path.join(_TGA_DIR, "common")
|
_TGA_DIR_COMMON = os.path.join(_TGA_DIR, "common")
|
||||||
|
@ -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), i16(s, 7)
|
start, size, mapdepth = i16(s, 3), i16(s, 5), i16(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