From ad4ade77817338753554171807217289b3e0ecf5 Mon Sep 17 00:00:00 2001 From: Victor Hall Date: Sun, 5 May 2024 20:03:09 -0400 Subject: [PATCH] script to check images now also does exif transpose in case --- scripts/check_images.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/check_images.py b/scripts/check_images.py index 2dd5c8b..81bac44 100644 --- a/scripts/check_images.py +++ b/scripts/check_images.py @@ -1,6 +1,6 @@ import os import argparse -from PIL import Image +from PIL import Image, ImageOps from typing import Generator SUPPORTED_EXT = [".jpg", ".png", ".jpeg", ".bmp", ".jfif", ".webp"] @@ -21,6 +21,7 @@ def main(args): for path in image_path_generator(args.data_root, do_recurse=True): try: img = Image.open(path) + img = ImageOps.exif_transpose(img) print(f"Checked OK {img.size} {img.mode} {path}") except Exception as e: print(f"FAILED: {path}")