From 8604a7f08f3a7f23c6b1c51bc5e5276ba8e8aa61 Mon Sep 17 00:00:00 2001 From: yedpodtrzitko Date: Wed, 1 May 2024 17:15:33 +0800 Subject: [PATCH 1/2] fix image thumbnails rotation --- tagstudio/src/qt/widgets/thumb_renderer.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tagstudio/src/qt/widgets/thumb_renderer.py b/tagstudio/src/qt/widgets/thumb_renderer.py index f13d0a4f..211f21e0 100644 --- a/tagstudio/src/qt/widgets/thumb_renderer.py +++ b/tagstudio/src/qt/widgets/thumb_renderer.py @@ -10,7 +10,7 @@ import os from pathlib import Path import cv2 -from PIL import Image, ImageChops, UnidentifiedImageError, ImageQt, ImageDraw, ImageFont, ImageEnhance +from PIL import Image, ImageChops, UnidentifiedImageError, ImageQt, ImageDraw, ImageFont, ImageEnhance, ImageOps from PySide6.QtCore import QObject, Signal, QSize from PySide6.QtGui import QPixmap from src.core.ts_core import PLAINTEXT_TYPES, VIDEO_TYPES, IMAGE_TYPES @@ -60,9 +60,6 @@ class ThumbRenderer(QObject): ext_font = ImageFont.truetype(os.path.normpath( f'{Path(__file__).parent.parent.parent.parent}/resources/qt/fonts/Oxanium-Bold.ttf'), math.floor(12*font_pixel_ratio)) - def __init__(self): - QObject.__init__(self) - def render(self, timestamp: float, filepath, base_size: tuple[int, int], pixelRatio: float, isLoading=False): """Renders an entry/element thumbnail for the GUI.""" adj_size: int = 1 @@ -107,6 +104,8 @@ class ThumbRenderer(QObject): if image.mode != 'RGB': image = image.convert(mode='RGB') + image = ImageOps.exif_transpose(image) + # Videos ======================================================= elif extension in VIDEO_TYPES: video = cv2.VideoCapture(filepath) From 3d5ed3a9489d182a1b06f225e0566ac8f9d56f76 Mon Sep 17 00:00:00 2001 From: Travis Abendshien Date: Wed, 1 May 2024 02:58:43 -0700 Subject: [PATCH 2/2] Added EXIF transpose to small thumbnails --- tagstudio/src/qt/widgets/thumb_renderer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tagstudio/src/qt/widgets/thumb_renderer.py b/tagstudio/src/qt/widgets/thumb_renderer.py index 211f21e0..be600304 100644 --- a/tagstudio/src/qt/widgets/thumb_renderer.py +++ b/tagstudio/src/qt/widgets/thumb_renderer.py @@ -264,6 +264,8 @@ class ThumbRenderer(QObject): image = new_bg if image.mode != 'RGB': image = image.convert(mode='RGB') + + image = ImageOps.exif_transpose(image) # Videos ======================================================= elif extension in VIDEO_TYPES: