mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 00:46:16 +03:00
Merge pull request #6644 from radarhere/convert
This commit is contained in:
commit
87a9d7197e
|
@ -38,6 +38,12 @@ def test_sanity():
|
|||
convert(im, output_mode)
|
||||
|
||||
|
||||
def test_unsupported_conversion():
|
||||
im = hopper()
|
||||
with pytest.raises(ValueError):
|
||||
im.convert("INVALID")
|
||||
|
||||
|
||||
def test_default():
|
||||
|
||||
im = hopper("P")
|
||||
|
|
|
@ -1051,7 +1051,10 @@ class Image:
|
|||
except ValueError:
|
||||
try:
|
||||
# normalize source image and try again
|
||||
im = self.im.convert(getmodebase(self.mode))
|
||||
modebase = getmodebase(self.mode)
|
||||
if modebase == self.mode:
|
||||
raise
|
||||
im = self.im.convert(modebase)
|
||||
im = im.convert(mode, dither)
|
||||
except KeyError as e:
|
||||
raise ValueError("illegal conversion") from e
|
||||
|
|
Loading…
Reference in New Issue
Block a user