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
10
PIL/Image.py
10
PIL/Image.py
|
@ -871,18 +871,16 @@ class Image(object):
|
|||
:returns: An :py:class:`~PIL.Image.Image` object.
|
||||
"""
|
||||
|
||||
if not mode:
|
||||
# determine default mode
|
||||
if self.mode == "P":
|
||||
self.load()
|
||||
|
||||
if not mode and self.mode == "P":
|
||||
# determine default mode
|
||||
if self.palette:
|
||||
mode = self.palette.mode
|
||||
else:
|
||||
mode = "RGB"
|
||||
else:
|
||||
if not mode or (mode == self.mode and not matrix):
|
||||
return self.copy()
|
||||
else:
|
||||
self.load()
|
||||
|
||||
if matrix:
|
||||
# matrix conversion
|
||||
|
|
Loading…
Reference in New Issue
Block a user