【327】Python 中 PIL 实现图像缩放

参考:Python 中使用PIL中的resize 进行缩放


实现代码如下:

from PIL import ImageGrab
img = Image.open('D:/tmp/4.jpg')
# 获取图像的大小
print(img.size)
# 获取图像 width
print(img.size[0])
# 获取图像 height
print(img.size[1])

img = img.resize((width, height),Image.ANTIALIAS) 

猜你喜欢

转载自www.cnblogs.com/alex-bn-lee/p/9218900.html
今日推荐