diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 2e7abfb68c9..d0d48971369 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -1074,11 +1074,14 @@ def quantize(self, colors=256, method=None, kmeans=0, palette=None, dither=1): if method is None: # defaults: - method = 0 + method = Image.MEDIANCUT if self.mode == "RGBA": - method = 2 + method = Image.FASTOCTREE - if self.mode == "RGBA" and method not in (2, 3): + if self.mode == "RGBA" and method not in ( + Image.FASTOCTREE, + Image.LIBIMAGEQUANT, + ): # Caller specified an invalid mode. raise ValueError( "Fast Octree (method == 2) and libimagequant (method == 3) "