From f40a20ba36354da271fda02ab7db8dc4930b6d72 Mon Sep 17 00:00:00 2001 From: MechTechnology <40597106+MechTechnology@users.noreply.github.com> Date: Sun, 1 Aug 2021 19:09:59 +0200 Subject: [PATCH] Fixes a possible crash condition - Should fix an edge case where it would crash by running out of the image's max index value. --- SmartStitchGUI.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SmartStitchGUI.py b/SmartStitchGUI.py index 22bda03..50ab198 100644 --- a/SmartStitchGUI.py +++ b/SmartStitchGUI.py @@ -50,7 +50,7 @@ def geticon(self, relative_path): # return os.path.join(base_path, relative_path) def SetupWindow(self): # Sets up Title and Logo - self.title('SmartStitch by MechTechnology [1.8]') + self.title('SmartStitch by MechTechnology [1.8.5]') self.iconbitmap(default=self.geticon("SmartStitchLogo.ico")) # Sets Window Size, centers it on Launch and Prevents Resize. @@ -270,11 +270,14 @@ def SmartAdjust(self, combined_pixels, split_height, split_offset, senstivity): # Where the smart magic happens, compares pixels of each row, to decide if it's okay to cut there AdjustSensitivity = int(255 * (1-(senstivity/100))) adjust_in_progress = True + last_row = len(combined_pixels) - 1 new_split_height = split_height countdown = True while (adjust_in_progress): adjust_in_progress = False split_row = split_offset + new_split_height + if (split_row == last_row): + break pixel_row = combined_pixels[split_row] prev_pixel = pixel_row[0] for x in range(1, len(pixel_row)):