https://www.cnblogs.com/yudis/articles/10114710.html
from PIL import Image
def is_valid(file): valid = True try: Image.open(file).load() except OSError: valid = False return valid