admin管理员组

文章数量:1654293

import os
from PIL import Image
folder_path = 'F:\\PetImages\\test_image'
extensions = []
for fldr in os.listdir(folder_path):
	sub_folder_path = os.path.join(folder_path, fldr)
    for filee in os.listdir(sub_folder_path):
        file_path = os.path.join(sub_folder_path, filee)
        print('** Path: {}  **'.format(file_path), end="\r", flush=True)
        im = Image.open(file_path)
        rgb_im = im.convert('RGB')
        if filee.split('.')[1] not in extensions:
            extensions.append(filee.split('.')[1])

对所有图片进行遍历,找出错误图片

本文标签: 出现错误图像UnidentifiedImageErroridentifyPython