Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use quantization method attributes #5353

Merged
merged 1 commit into from Mar 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/PIL/Image.py
Expand Up @@ -1074,11 +1074,11 @@ def quantize(self, colors=256, method=None, kmeans=0, palette=None, dither=1):

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) "
Expand Down