问题描述
我使用PIL打开并保存相同的jpg图像,但是尺寸大大减小了.有人可以解释一下幕后情况吗?
I used PIL to open and save the same jpg image, but the size reduces significantly. Could somebody explained what's going on under the hood?
我跑步
a = Image.open('a.jpg')
a.save('b.jpg')
a.jpg的大小为5MB,而b.jpg的大小仅为600KB.然后将它们放大并进行比较,基本上看不出图像质量有什么不同.有人可以解释一下吗?
a.jpg has the size 5MB, whereas b.jpg is only 600KB. and I enlarge them and compared side by side and basically see no differences in the picture quality. Could somebody explain this?
非常感谢!
推荐答案
Pillow中jpg的默认保存质量为75.我敢打赌,您的原始图像会以更高的质量设置保存.
The default save quality for jpg in Pillow is 75. I bet your original image is saved with a higher quality setting.
http://pillow.readthedocs.io/zh-CN/3.2.x/handbook/image-file-formats.html#jpeg
这篇关于Python PIL图像打开并保存更改图像文件的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!