mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-15 20:06:28 +03:00
If image is already in the destination mode and there is no matrix, do not convert
This commit is contained in:
parent
411765a69c
commit
d8c088ed8b
18
PIL/Image.py
18
PIL/Image.py
|
@ -871,18 +871,16 @@ class Image(object):
|
||||||
:returns: An :py:class:`~PIL.Image.Image` object.
|
:returns: An :py:class:`~PIL.Image.Image` object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not mode:
|
self.load()
|
||||||
|
|
||||||
|
if not mode and self.mode == "P":
|
||||||
# determine default mode
|
# determine default mode
|
||||||
if self.mode == "P":
|
if self.palette:
|
||||||
self.load()
|
mode = self.palette.mode
|
||||||
if self.palette:
|
|
||||||
mode = self.palette.mode
|
|
||||||
else:
|
|
||||||
mode = "RGB"
|
|
||||||
else:
|
else:
|
||||||
return self.copy()
|
mode = "RGB"
|
||||||
else:
|
if not mode or (mode == self.mode and not matrix):
|
||||||
self.load()
|
return self.copy()
|
||||||
|
|
||||||
if matrix:
|
if matrix:
|
||||||
# matrix conversion
|
# matrix conversion
|
||||||
|
|
Loading…
Reference in New Issue
Block a user