本文实例讲述了Python实现批量修改图片格式和大小的方法。分享给大家供大家参考,具体如下:
第一种方法用到opencv库
import os
import time
import cv2
def alter(path,object):
result = []
s = os.listdir(path)
count = 1
for i in s:
document = os.path.join(path,i)
img = cv2.imread(document)
本文实例讲述了python使用PIL缩放网络图片并保存的方法。分享给大家供大家参考。具体实现方法如下:
''' tk_image_view_url_io_resize.py
display an image from a URL using Tkinter, PIL and data_stream
also resize the web image to fit a certain size display widget
retaining its aspect ratio
Pil facil