mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-09 06:44:45 +03:00
Simplified check for number of channels
This commit is contained in:
parent
5593b629b9
commit
7725aa5f4e
|
@ -1297,13 +1297,8 @@ class Image:
|
|||
elif quality != 1.0:
|
||||
self.thumbnail((quality * self.width, quality * self.height))
|
||||
|
||||
if self.mode in ("F", "L", "I", "P"):
|
||||
channels = 1
|
||||
elif self.mode in ("RGB", "YCbCr", "LAB", "HSV"):
|
||||
channels = 3
|
||||
elif self.mode in ("RGBA", "CMYK"):
|
||||
channels = 4
|
||||
else:
|
||||
channels = self.im.bands
|
||||
if channels not in (1, 3, 4):
|
||||
raise ValueError("Unsupported image mode")
|
||||
|
||||
def euclidean(p1, p2):
|
||||
|
|
Loading…
Reference in New Issue
Block a user