mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Merge pull request #8256 from radarhere/jpeg2000_rgba
This commit is contained in:
commit
7e838bf409
|
@ -400,6 +400,13 @@ def test_pclr() -> None:
|
||||||
assert len(im.palette.colors) == 256
|
assert len(im.palette.colors) == 256
|
||||||
assert im.palette.colors[(255, 255, 255)] == 0
|
assert im.palette.colors[(255, 255, 255)] == 0
|
||||||
|
|
||||||
|
with Image.open(
|
||||||
|
f"{EXTRA_DIR}/147af3f1083de4393666b7d99b01b58b_signal_sigsegv_130c531_6155_5136.jp2"
|
||||||
|
) as im:
|
||||||
|
assert im.mode == "P"
|
||||||
|
assert len(im.palette.colors) == 139
|
||||||
|
assert im.palette.colors[(0, 0, 0, 0)] == 0
|
||||||
|
|
||||||
|
|
||||||
def test_comment() -> None:
|
def test_comment() -> None:
|
||||||
with Image.open("Tests/images/comment.jp2") as im:
|
with Image.open("Tests/images/comment.jp2") as im:
|
||||||
|
|
|
@ -205,7 +205,7 @@ def _parse_jp2_header(
|
||||||
if bitdepth > max_bitdepth:
|
if bitdepth > max_bitdepth:
|
||||||
max_bitdepth = bitdepth
|
max_bitdepth = bitdepth
|
||||||
if max_bitdepth <= 8:
|
if max_bitdepth <= 8:
|
||||||
palette = ImagePalette.ImagePalette()
|
palette = ImagePalette.ImagePalette("RGBA" if npc == 4 else "RGB")
|
||||||
for i in range(ne):
|
for i in range(ne):
|
||||||
color: list[int] = []
|
color: list[int] = []
|
||||||
for value in header.read_fields(">" + ("B" * npc)):
|
for value in header.read_fields(">" + ("B" * npc)):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user