Merge pull request #5353 from radarhere/quantize_attributes

Use quantization method attributes
This commit is contained in:
Hugo van Kemenade 2021-03-27 20:01:49 +02:00 committed by GitHub
commit 5e1d304769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1080,11 +1080,11 @@ class Image:
if method is None:
# defaults:
method = 0
method = MEDIANCUT
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.
raise ValueError(
"Fast Octree (method == 2) and libimagequant (method == 3) "