Use quantization method attributes

This commit is contained in:
Andrew Murray 2021-03-22 19:44:56 +11:00
parent aa35f6b572
commit 4e0bc3bab6

View File

@ -1074,11 +1074,11 @@ class Image:
if method is None: if method is None:
# defaults: # defaults:
method = 0 method = MEDIANCUT
if self.mode == "RGBA": if self.mode == "RGBA":
method = 2 method = FASTOCTREE
if self.mode == "RGBA" and method not in (2, 3): if self.mode == "RGBA" and method not in (FASTOCTREE, LIBIMAGEQUANT):
# Caller specified an invalid mode. # Caller specified an invalid mode.
raise ValueError( raise ValueError(
"Fast Octree (method == 2) and libimagequant (method == 3) " "Fast Octree (method == 2) and libimagequant (method == 3) "