设置读入、输出文件以及缩小/放大比例
imgfile
= 'E:/PycharmProjects/PracticalTableau/img/191119-8.png'
outfile
= 'E:/PycharmProjects/PracticalTableau/img/191119-8_resize.png'
resize
= 0.8
缩小/放大图片文件并输出
from PIL
import Image
img
= Image
.open(imgfile
)
w
,h
= img
.size
w
,h
= round(w
* resize
),round(h
* resize
)
img
= img
.resize
((w
,h
), Image
.ANTIALIAS
)
img
.save
(outfile
, optimize
=True, quality
=85)
转载请注明原文地址:https://ipadbbs.8miu.com/read-53284.html