Created
January 9, 2012 09:06
-
-
Save mpuig/1582085 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