小脚本

1.图片旋转

from PIL import Image
import os
root_dir = "/data_1/Yang/project_new/2020/tf_study/tf-resnet/data/0/"
save_dir = "/data_1/Yang/project_new/2020/tf_study/tf-resnet/data/1/1_"
list_dir = os.listdir(root_dir)
for file_name in list_dir:
    path = root_dir + file_name
    save_path = save_dir + file_name
    im = Image.open(path)
    #im.show()
    im_rot = im.rotate(180)
    #im_rot.show()
    im_rot.save(save_path,"png")
posted @ 2020-03-02 14:56  无左无右  阅读(167)  评论(0编辑  收藏  举报