How to reduce the image file size using PIL
A built-in parameter for saving JPEGs and PNGs is optimize. from PIL import Image foo = Image.open(‘path/to/image.jpg’) # My image is a 200×374 jpeg that is 102kb large foo.size # (200, 374) # downsize the image with an ANTIALIAS filter (gives the highest quality) foo = foo.resize((160,300),Image.ANTIALIAS) foo.save(‘path/to/save/image_scaled.jpg’, quality=95) # The saved downsized image size … Read more