![]() # Really old versions of Pillow (before 4.x) have _new Im = silf.im.convert("P", 1 if dither else 0, palette.im) "only RGB or L mode images can be quantized to a palette" If silf.mode != "RGB" and silf.mode != "L": Raise ValueError("bad mode for palette image") """Convert an RGB or L mode image to use a given P image's palette.""" #!/usr/bin/env python3ĭef quantizetopalette(silf, palette, dither=False): So I pulled a copy of the quantize() method out and changed that.īecause it relies on an ostensibly private method, it may not work in future versions of Pillow.īy then, however, we can expect Pillow pre-6 to have passed out of use, as both Debian "bullseye" (stable in mid-2021) and Ubuntu "focal" (LTS in mid-2020) package Pillow 7 or newer. The problem I was facing is that quantize() in dist-packages/PIL/Image.py forces the dither argument to 1.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |