transpose exif

This commit is contained in:
Lain Iwakura 2025-01-09 20:37:46 -03:00
parent 32a274f800
commit 9ea814be78
Signed by: lain
GPG key ID: 89686F4239E80508

View file

@ -1,7 +1,7 @@
from io import BytesIO
from typing import Tuple
from PIL import Image
from PIL import Image, ImageOps
from pillow_heif import HeifImagePlugin
from typing import Type
@ -160,6 +160,7 @@ class HateHeifBot(Plugin):
# de-heif via pillow
img_in = Image.open(BytesIO(data))
self.log.debug(f"Received image parameters: {img_in.format} {img_in.size} {img_in.mode}")
ImageOps.exif_transpose(img_in, in_place=True)
with BytesIO() as img_out:
img_in.save(img_out, format="JPEG")
img = img_out.getvalue()