From 9592830e67586f929e33428208920cdd824f0d1b Mon Sep 17 00:00:00 2001 From: pax Date: Sat, 11 Apr 2026 22:26:28 -0500 Subject: [PATCH] grid: store source pixmap for lossless re-scaling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit set_pixmap now keeps the original pixmap alongside the scaled display copy. Used by live thumbnail resize in settings — re-scales from the source instead of the already-scaled pixmap, preventing quality degradation when changing sizes up and down. --- booru_viewer/gui/grid.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/booru_viewer/gui/grid.py b/booru_viewer/gui/grid.py index 6726061..e943862 100644 --- a/booru_viewer/gui/grid.py +++ b/booru_viewer/gui/grid.py @@ -74,6 +74,7 @@ class ThumbnailWidget(QWidget): super().__init__(parent) self.index = index self._pixmap: QPixmap | None = None + self._source_pixmap: QPixmap | None = None # original, for re-scaling on size change self._selected = False self._multi_selected = False self._bookmarked = False @@ -97,6 +98,7 @@ class ThumbnailWidget(QWidget): self.setMouseTracking(True) def set_pixmap(self, pixmap: QPixmap) -> None: + self._source_pixmap = pixmap self._pixmap = pixmap.scaled( THUMB_SIZE - 4, THUMB_SIZE - 4, Qt.AspectRatioMode.KeepAspectRatio,