Skip to content

Commit

Permalink
Fixes a possible crash condition
Browse files Browse the repository at this point in the history
- Should fix an edge case where it would crash by running out of the image's max index value.
  • Loading branch information
MechTechnology authored Aug 1, 2021
1 parent e6bef65 commit f40a20b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion SmartStitchGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)):
Expand Down

0 comments on commit f40a20b

Please sign in to comment.