# 图像缩放 import io from PIL import Image def resize_image(ori_img, dst_img): pil_image = Image.open(ori_img) # get the size of the image ori_w, ori_h = pil_image.size pil_image_resized = pil_image.resize((ori_w/4, ori_h/4), Image.ANTIALIAS) pil_image_resized.save(dst_img) #源图片 ori_img = r'D:\mobile\20150917112239.png' #目标图片 dst_img = r'D:\python_2.png' resize_image(ori_img, dst_img)