python批量修改图片名字
程序员文章站
2022-04-18 19:50:02
...
写了一个简单的脚本,来批量修改一些顺序图片,如图片的顺序是200,201,202.....将其修改为0,1,2......
import os
import skimage.io as io
def pic_name(test_path,):
filenames = os.listdir(test_path)
num_image = len(filenames)
for i in range(num_image):
i =i+200
img = io.imread(os.path.join(test_path, '%s.png'%i), as_gray=True)
io.imsave(os.path.join(r'C:\........' , '%s.png' % (i-100)), img)
pic_name(r'C:\Users\.....')