Reduce the file size of an image in Python
from PIL import Image im = Image.open(img_file) im.convert('P', palette=Image.ADAPTIVE, colors=256).save(img_file)