Created
October 5, 2016 21:00
-
-
Save mikecharles/90a0243c535e8e209dc27d0093c66059 to your computer and use it in GitHub Desktop.
Reduce the file size of an image in Python
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
from PIL import Image | |
im = Image.open(img_file) | |
im.convert('P', palette=Image.ADAPTIVE, colors=256).save(img_file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment