From 419dc1eada320b972fc01c2b0671f33266fbc8f8 Mon Sep 17 00:00:00 2001 From: Mr Finchum Date: Tue, 1 Apr 2025 16:30:21 +0000 Subject: [PATCH] patch: better performance for preview window --- .gitignore | 1 + CHANGELOG.md | 12 +++++++++--- src/OptimaLab35/previewWindow.py | 9 ++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 7a56971..e8383c6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ dist/ __pycache__/ .flatpak-builder/ flatpak-build-dir/ +*.jpg diff --git a/CHANGELOG.md b/CHANGELOG.md index c498256..77ca8c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,19 @@ # Changelog ## 1.3.x -### 1.3.2 Fix - Fixed problem with app folders +### 1.3.3: Patch – Increased Preview Performance x2 +- Reduced preview stutter: Previously, the image was updated twice when changing brightness or contrast. Now, it updates only once, improving performance by 100%. +- There is still room for improvement. Analysis shows that image processing takes the most time, while displaying in Qt is relatively fast. Reducing the image size impacts performance, so resizing to 50% is a good idea. +- There is an issue where `QRunner` does not always finish in the correct order when brightness or contrast values are changed rapidly. ATM I do not know how to fix this easly. +- The "Preview" watermark now displays the brightness and contrast levels of the shown image. + +### 1.3.2 Fix - Fixed problem with app folders (25.03.30) - Fixed a problem that the app folder path was not generated correctly. -### 1.3.1: Fix - Fixed insert exif not working +### 1.3.1: Fix - Fixed insert exif not working (25.03.27) - Fixed the feature that inserted exif into images without modifying them. -### 1.3.0: Feature – Write Adjustments into EXIF +### 1.3.0: Feature – Write Adjustments into EXIF (25.03.24) - Changes to contrast and brightness are now recorded in the EXIF comment section (labeled *Scanner* in the program). - This allows users to track what adjustments were made to an image. diff --git a/src/OptimaLab35/previewWindow.py b/src/OptimaLab35/previewWindow.py index 72469be..8f0a656 100644 --- a/src/OptimaLab35/previewWindow.py +++ b/src/OptimaLab35/previewWindow.py @@ -50,10 +50,8 @@ class PreviewWindow(QMainWindow, Ui_Preview_Window): self.ui.reset_contrast_Button.clicked.connect(lambda: self.ui.contrast_spinBox.setValue(0)) # Connect UI elements to `on_ui_change` - self.ui.brightness_spinBox.valueChanged.connect(self.on_ui_change) - self.ui.brightness_Slider.valueChanged.connect(self.on_ui_change) - self.ui.contrast_spinBox.valueChanged.connect(self.on_ui_change) - self.ui.contrast_Slider.valueChanged.connect(self.on_ui_change) + self.ui.brightness_spinBox.valueChanged.connect(self.on_ui_change) # brightness slider changes spinbox value, do not need an event for the slider + self.ui.contrast_spinBox.valueChanged.connect(self.on_ui_change) # contrast slider changes spinbox value, do not need an event for the slider self.ui.grayscale_checkBox.stateChanged.connect(self.on_ui_change) self.ui_elements(False) self.ui.show_OG_Button.pressed.connect(self.show_OG_image) @@ -154,7 +152,8 @@ class ImageProcessorWorker(QRunnable): try: img = self.optima_manager.process_image_object( image_input_file = self.path, - watermark = "PREVIEW", + watermark = f"PREVIEW B:{self.brightness} S:{self.contrast}", + font_size = 1, resize = self.resize, grayscale = self.grayscale, brightness = self.brightness,