Python 有没有办法使PIL';s ImageGrab.grab()是否保存小尺寸的照片?

Python 有没有办法使PIL';s ImageGrab.grab()是否保存小尺寸的照片?,python,python-3.x,Python,Python 3.x,我正在使用PIL和Python3.8来制作我的screeen的屏幕截图,但是它们的大小太大了。如何缩小它?您可以在保存之前使用缩小图像 from PIL import Image im = Image.open("hopper.jpg") # Provide the target width and height of the image (width, height) = (im.width // 2, im.height // 2) im_resized = im.resize((width

我正在使用PIL和Python3.8来制作我的screeen的屏幕截图,但是它们的大小太大了。如何缩小它?

您可以在保存之前使用缩小图像

from PIL import Image
im = Image.open("hopper.jpg")
# Provide the target width and height of the image
(width, height) = (im.width // 2, im.height // 2)
im_resized = im.resize((width, height))

来源

这是否回答了您的问题?