How to reduce the image file size using PIL
问题 I am using PIL to resize the images there by converting larger images to smaller ones. Are there any standard ways to reduce the file size of the image without losing the quality too much, lets say the original size of the image is 100KB, i want to get it down to like 5 or 10 KB especially for png and jpeg formats. 回答1: A built-in parameter for saving JPEGs and PNGs is optimize . >>> from PIL import Image # My image is a 200x374 jpeg that is 102kb large >>> foo = Image.open("path\\to\\image