sd-scripts icon indicating copy to clipboard operation
sd-scripts copied to clipboard

warn or transpose images with exif rotation

Open no-username-ideas-left opened this issue 9 months ago • 0 comments

https://github.com/kohya-ss/sd-scripts/blob/71e2c91330a9d866ec05cdd10584bbb962896a99/library/train_util.py#L2349

Minor issue, but would it be possible to warn users if exif rotational information for an image is found? I had some images in my training set which were rotated only by exif data, so when they were loaded in by Pillow, their rotation was ignored, making my captions inaccurate ("from side").

(I have exif rotated images because Windows' built-in image rotation function rotates by exif only for some file extensions, like .jpeg. I believe digital cameras and phone cameras also use exif rotation metadata).

Alternatively, could load_image() use the Pillow method to automatically rotate the image by exif orientation?

PIL.ImageOps.exif_transpose(image, in_place=True)

no-username-ideas-left avatar May 06 '24 00:05 no-username-ideas-left