def rotate_save(path):
filepath = os.path.join(os.getcwd(),path)
images_files = os.listdir(filepath)
num_img = 0
for i,image in enumerate(images_files):
image_file = os.path.join(filepath,image)
try:
img = ndimage.imread(image_file)
img = img[:,:,0]
new_im = img.fromarray(img)
for j in range(0,360,72):
im = new_im.rotate(j)
filename = "%s%05d.png"%(path,num_img)
im.save(filename)
num_img+=1
except Exception as e:
print('Could not read:', image_file, ':', e, '- it\'s ok, skipping.')
评论列表
文章目录