👨🏼‍💻개발/PIL

PIL - 이미지 회전 현상 해결 방법

Janger 2024. 4. 20. 01:25
728x90

 

원인 및 해결

 

EXIF의 방향 태그가 원인, 해결 방안으로 ImageOps.exif_transpose()로 EXIF 방향 태그 제거

 

 

from PIL import Image, ImageOps
im = Image.open("file.jpg")
im = ImageOps.exif_transpose(im)

 

 

https://stackoverflow.com/questions/4228530/pil-thumbnail-is-rotating-my-image

https://pillow.readthedocs.io/en/latest/reference/ImageOps.html#PIL.ImageOps.exif_transpose

https://yjs-program.tistory.com/272

https://github.com/python-pillow/Pillow/issues/4703#issuecomment-645219973

728x90