mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-26 16:50:33 +03:00
Set mode to L if palette is missing
This commit is contained in:
parent
50e9a92c98
commit
63987b7aba
|
@ -133,6 +133,11 @@ def test_small_palette(tmp_path: Path) -> None:
|
|||
assert reloaded.getpalette() == colors
|
||||
|
||||
|
||||
def test_missing_palette() -> None:
|
||||
with Image.open("Tests/images/dilation4.lut") as im:
|
||||
assert im.mode == "L"
|
||||
|
||||
|
||||
def test_save_wrong_mode(tmp_path: Path) -> None:
|
||||
im = hopper("PA")
|
||||
out = str(tmp_path / "temp.tga")
|
||||
|
|
|
@ -85,7 +85,7 @@ class TgaImageFile(ImageFile.ImageFile):
|
|||
elif depth == 16:
|
||||
self._mode = "LA"
|
||||
elif imagetype in (1, 9):
|
||||
self._mode = "P"
|
||||
self._mode = "P" if colormaptype else "L"
|
||||
elif imagetype in (2, 10):
|
||||
self._mode = "RGB"
|
||||
if depth == 32:
|
||||
|
|
Loading…
Reference in New Issue
Block a user