Skip to content Skip to sidebar Skip to footer

Image Size Shrunk Out Of Nowhere

I simply copied my image and saved it to another temp folder in the current directory, nothing is modified, but the image size is somehow reduced... why? from PIL import Image imp

Solution 1:

When PIL/Pillow saves your image as a JPEG, it uses a default quality of 75 and this is likely lower than the quality at which your original image was saved, hence the file is smaller.

You can readily check the quality of your input and output files with jhead like this:

jhead image.jpg

Sample Output

File name    :image.jpgFile size    :199131bytesFile date    :2018:11:1309:42:59Resolution   :1374 x1182JPEG Quality :75

If you wish to retain more quality, you can specify a different value from 75 when saving. It is not recommended to go above 95 as it increases file size with no benefit:

img.save('result.jpg', quality=90)

Post a Comment for "Image Size Shrunk Out Of Nowhere"