Skip to content

Instantly share code, notes, and snippets.

@mpuig
Created January 9, 2012 09:06
Show Gist options
  • Save mpuig/1582085 to your computer and use it in GitHub Desktop.
Save mpuig/1582085 to your computer and use it in GitHub Desktop.
How to reduce color palette with PIL
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