diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0b81bfd..b1a63b1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,17 +1,23 @@
# Changelog
-### 0.14.x
-#### 0.14.1: Patch changelog
+## 0.15.0: Preview Image Resizing Update
+- Added the ability to change the preview image size dynamically.
+- Previously, the image was processed and displayed at its original size, causing lag or unresponsiveness when adjusting the slider.
+- Reducing the processed image size should help improve performance.
+- Default preview image size is now **25%**, but users can adjust it between **10% and 100%**.
+
+## 0.14.x
+### 0.14.1: Patch changelog
- Updated the changelog to include missing entries.
-#### 0.14.0: Code refactor (by Mr. Finch)
+### 0.14.0: Code refactor (by Mr. Finch)
- Introduced constants and optimized the code.
-### 0.13.x
-#### 0.13.1: Fixed image processing
+## 0.13.x
+### 0.13.1: Fixed image processing
- Fixed a bug that made it impossible to process images.
-#### 0.13.0: Requirements file (by Mr. Finch)
+### 0.13.0: Requirements file (by Mr. Finch)
- Added a requirements file.
## 0.12.x
diff --git a/src/OptimaLab35/gui.py b/src/OptimaLab35/gui.py
index 35d8707..187a8c1 100644
--- a/src/OptimaLab35/gui.py
+++ b/src/OptimaLab35/gui.py
@@ -858,12 +858,13 @@ class PreviewWindow(QMainWindow, Ui_Preview_Window):
path = self.ui.image_path_lineEdit.text()
worker = ImageProcessorWorker(
- path=path,
- optima_manager=self.o,
- brightness=int(self.ui.brightness_spinBox.text()),
- contrast=int(self.ui.contrast_spinBox.text()),
- grayscale=self.ui.grayscale_checkBox.isChecked(),
- callback=self.display_image # Callback to update UI
+ path = path,
+ optima_manager = self.o,
+ brightness = int(self.ui.brightness_spinBox.text()),
+ contrast = int(self.ui.contrast_spinBox.text()),
+ grayscale = self.ui.grayscale_checkBox.isChecked(),
+ resize = self.ui.scale_Slider.value(),
+ callback = self.display_image # Callback to update UI
)
self.threadpool.start(worker) # Run worker in a thread
@@ -943,13 +944,14 @@ class ImageProcessorRunnable(QRunnable):
class ImageProcessorWorker(QRunnable):
"""Worker class to load and process the image in a separate thread."""
# ChatGPT
- def __init__(self, path, optima_manager, brightness, contrast, grayscale, callback):
+ def __init__(self, path, optima_manager, brightness, contrast, grayscale, resize, callback):
super().__init__()
self.path = path
self.optima_manager = optima_manager
self.brightness = brightness
self.contrast = contrast
self.grayscale = grayscale
+ self.resize = resize
self.callback = callback # Function to call when processing is done
@Slot()
@@ -961,12 +963,12 @@ class ImageProcessorWorker(QRunnable):
try:
img = self.optima_manager.process_image_object(
- image_input_file=self.path,
- watermark="PREVIEW",
- resize=100,
- grayscale=self.grayscale,
- brightness=self.brightness,
- contrast=self.contrast
+ image_input_file = self.path,
+ watermark = "PREVIEW",
+ resize = self.resize,
+ grayscale = self.grayscale,
+ brightness = self.brightness,
+ contrast = self.contrast
)
pixmap = QPixmap.fromImage(img)
self.callback(pixmap)
diff --git a/src/OptimaLab35/ui/preview_window.py b/src/OptimaLab35/ui/preview_window.py
index 3381324..b210144 100644
--- a/src/OptimaLab35/ui/preview_window.py
+++ b/src/OptimaLab35/ui/preview_window.py
@@ -43,8 +43,8 @@ class Ui_Preview_Window(object):
self.widget.setObjectName(u"widget")
self.widget.setMinimumSize(QSize(160, 628))
self.widget.setMaximumSize(QSize(150, 16777215))
- self.verticalLayout_5 = QVBoxLayout(self.widget)
- self.verticalLayout_5.setObjectName(u"verticalLayout_5")
+ self.verticalLayout_4 = QVBoxLayout(self.widget)
+ self.verticalLayout_4.setObjectName(u"verticalLayout_4")
self.groupBox_3 = QGroupBox(self.widget)
self.groupBox_3.setObjectName(u"groupBox_3")
self.verticalLayout_3 = QVBoxLayout(self.groupBox_3)
@@ -60,7 +60,7 @@ class Ui_Preview_Window(object):
self.verticalLayout_3.addWidget(self.load_Button)
- self.verticalLayout_5.addWidget(self.groupBox_3)
+ self.verticalLayout_4.addWidget(self.groupBox_3)
self.groupBox_2 = QGroupBox(self.widget)
self.groupBox_2.setObjectName(u"groupBox_2")
@@ -87,7 +87,7 @@ class Ui_Preview_Window(object):
self.verticalLayout.addWidget(self.reset_brightness_Button)
- self.verticalLayout_5.addWidget(self.groupBox_2)
+ self.verticalLayout_4.addWidget(self.groupBox_2)
self.groupBox = QGroupBox(self.widget)
self.groupBox.setObjectName(u"groupBox")
@@ -114,7 +114,7 @@ class Ui_Preview_Window(object):
self.verticalLayout_2.addWidget(self.reset_contrast_Button)
- self.verticalLayout_5.addWidget(self.groupBox)
+ self.verticalLayout_4.addWidget(self.groupBox)
self.groupBox_5 = QGroupBox(self.widget)
self.groupBox_5.setObjectName(u"groupBox_5")
@@ -126,43 +126,58 @@ class Ui_Preview_Window(object):
self.gridLayout.addWidget(self.grayscale_checkBox, 0, 0, 1, 1)
- self.verticalLayout_5.addWidget(self.groupBox_5)
+ self.verticalLayout_4.addWidget(self.groupBox_5)
self.verticalSpacer = QSpacerItem(20, 219, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
- self.verticalLayout_5.addItem(self.verticalSpacer)
+ self.verticalLayout_4.addItem(self.verticalSpacer)
self.groupBox_4 = QGroupBox(self.widget)
self.groupBox_4.setObjectName(u"groupBox_4")
- self.verticalLayout_4 = QVBoxLayout(self.groupBox_4)
- self.verticalLayout_4.setObjectName(u"verticalLayout_4")
+ self.gridLayout_2 = QGridLayout(self.groupBox_4)
+ self.gridLayout_2.setObjectName(u"gridLayout_2")
self.live_update = QCheckBox(self.groupBox_4)
self.live_update.setObjectName(u"live_update")
self.live_update.setChecked(True)
- self.verticalLayout_4.addWidget(self.live_update)
+ self.gridLayout_2.addWidget(self.live_update, 0, 0, 1, 1)
+
+ self.scale_label = QLabel(self.groupBox_4)
+ self.scale_label.setObjectName(u"scale_label")
+
+ self.gridLayout_2.addWidget(self.scale_label, 0, 1, 1, 1)
+
+ self.scale_Slider = QSlider(self.groupBox_4)
+ self.scale_Slider.setObjectName(u"scale_Slider")
+ self.scale_Slider.setMinimum(10)
+ self.scale_Slider.setMaximum(100)
+ self.scale_Slider.setPageStep(10)
+ self.scale_Slider.setValue(25)
+ self.scale_Slider.setOrientation(Qt.Horizontal)
+
+ self.gridLayout_2.addWidget(self.scale_Slider, 1, 0, 1, 2)
self.update_Button = QPushButton(self.groupBox_4)
self.update_Button.setObjectName(u"update_Button")
self.update_Button.setEnabled(False)
self.update_Button.setAutoFillBackground(False)
- self.verticalLayout_4.addWidget(self.update_Button)
+ self.gridLayout_2.addWidget(self.update_Button, 2, 0, 1, 2)
self.checkBox = QCheckBox(self.groupBox_4)
self.checkBox.setObjectName(u"checkBox")
self.checkBox.setLayoutDirection(Qt.LeftToRight)
self.checkBox.setChecked(True)
- self.verticalLayout_4.addWidget(self.checkBox)
+ self.gridLayout_2.addWidget(self.checkBox, 3, 0, 1, 2)
self.close_Button = QPushButton(self.groupBox_4)
self.close_Button.setObjectName(u"close_Button")
- self.verticalLayout_4.addWidget(self.close_Button)
+ self.gridLayout_2.addWidget(self.close_Button, 4, 0, 1, 2)
- self.verticalLayout_5.addWidget(self.groupBox_4)
+ self.verticalLayout_4.addWidget(self.groupBox_4)
self.horizontalLayout.addWidget(self.widget)
@@ -170,7 +185,7 @@ class Ui_Preview_Window(object):
Preview_Window.setCentralWidget(self.centralwidget)
self.menubar = QMenuBar(Preview_Window)
self.menubar.setObjectName(u"menubar")
- self.menubar.setGeometry(QRect(0, 0, 875, 27))
+ self.menubar.setGeometry(QRect(0, 0, 875, 22))
Preview_Window.setMenuBar(self.menubar)
self.retranslateUi(Preview_Window)
@@ -179,6 +194,7 @@ class Ui_Preview_Window(object):
self.contrast_Slider.valueChanged.connect(self.contrast_spinBox.setValue)
self.contrast_spinBox.valueChanged.connect(self.contrast_Slider.setValue)
self.live_update.toggled.connect(self.update_Button.setDisabled)
+ self.scale_Slider.valueChanged.connect(self.scale_label.setNum)
QMetaObject.connectSlotsByName(Preview_Window)
# setupUi
@@ -212,6 +228,13 @@ class Ui_Preview_Window(object):
self.live_update.setToolTip(QCoreApplication.translate("Preview_Window", u"Live update applies changes instantly. If the app becomes unresponsive or lags, disable this option.", None))
#endif // QT_CONFIG(tooltip)
self.live_update.setText(QCoreApplication.translate("Preview_Window", u"Live refresh", None))
+#if QT_CONFIG(tooltip)
+ self.scale_label.setToolTip(QCoreApplication.translate("Preview_Window", u"Sets the resize value for the preview image. A high value may cause the application to freeze.", None))
+#endif // QT_CONFIG(tooltip)
+ self.scale_label.setText(QCoreApplication.translate("Preview_Window", u"25", None))
+#if QT_CONFIG(tooltip)
+ self.scale_Slider.setToolTip(QCoreApplication.translate("Preview_Window", u"Sets the resize value for the preview image. A high value may cause the application to freeze.", None))
+#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(tooltip)
self.update_Button.setToolTip(QCoreApplication.translate("Preview_Window", u"Apply Changes to Preview", None))
#endif // QT_CONFIG(tooltip)
diff --git a/src/OptimaLab35/ui/preview_window.ui b/src/OptimaLab35/ui/preview_window.ui
index 1e8066f..3408bd7 100644
--- a/src/OptimaLab35/ui/preview_window.ui
+++ b/src/OptimaLab35/ui/preview_window.ui
@@ -54,7 +54,7 @@
16777215
-
+
-
@@ -202,8 +202,8 @@
Behavior
-
-
-
+
+
-
Live update applies changes instantly. If the app becomes unresponsive or lags, disable this option.
@@ -216,7 +216,39 @@
- -
+
-
+
+
+ Sets the resize value for the preview image. A high value may cause the application to freeze.
+
+
+ 25
+
+
+
+ -
+
+
+ Sets the resize value for the preview image. A high value may cause the application to freeze.
+
+
+ 10
+
+
+ 100
+
+
+ 10
+
+
+ 25
+
+
+ Qt::Horizontal
+
+
+
+ -
false
@@ -232,7 +264,7 @@
- -
+
-
Enable to copy adjustments to the main window upon closing
@@ -248,7 +280,7 @@
- -
+
-
@@ -272,7 +304,7 @@
0
0
875
- 27
+ 22
@@ -359,5 +391,21 @@
+
+ scale_Slider
+ valueChanged(int)
+ scale_label
+ setNum(int)
+
+
+ 783
+ 644
+
+
+ 831
+ 619
+
+
+