Image size shrunk out of nowhere

不羁的心 提交于 2019-12-01 23:44:06

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.jpg
File size    : 199131 bytes
File date    : 2018:11:13 09:42:59
Resolution   : 1374 x 1182
JPEG 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)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!