From 9ea814be787c3a6bdf03d32e007d0337f855c037 Mon Sep 17 00:00:00 2001 From: Lain Date: Thu, 9 Jan 2025 20:37:46 -0300 Subject: [PATCH] transpose exif --- hateheif.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hateheif.py b/hateheif.py index 20fcfe0..57a92c7 100644 --- a/hateheif.py +++ b/hateheif.py @@ -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()