参考: Python 中使用 PIL 中的 resize 进行缩放 https://blog.csdn.net/u010417185/article/details/74357382
实现代码如下:
- 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)
来源: http://www.bubuko.com/infodetail-2656708.html