import os
import cv2
path='./images'
img_filenames=os.listdir(path)
img_files=[]
output_path='./images_resize'
for img_filename in img_filenames:
img_file=os.path.join(path,img_filename)
img_files.append(img_file)
img=cv2.imread(img_file)
if img.shape[1]==800:
print(img_filename)
print('ok')
'''
print('original_size:',img.shape)
img=cv2.resize(img,(1080,720))
print('new_size:',img.shape)
out_filename=os.path.join(output_path,img_filename)
cv2.imwrite(out_filename,img)
'''
批量改变图像大小
最新推荐文章于 2024-09-03 17:22:28 发布