-
-
Save dogterbox/f4f6e75ab0b954be9ed75c7178135a88 to your computer and use it in GitHub Desktop.
How to reduce color palette with PIL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Image | |
im = Image.open('image.jpg') | |
# using Image.ADAPTIVE to avoid dithering | |
out = im.convert('P', palette=Image.ADAPTIVE, colors=5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment