diff --git a/output.json b/output.json index 8082f48..0c46ff1 100644 --- a/output.json +++ b/output.json @@ -1,46 +1,46 @@ { - "row_col": "2,2", - "row_col_one_img": "1,1", - "show_scale": "0.32,0.32", - "row_col_img_unit": "3,1", - "gap": "10,10,5,5,3,3,2,2", - "magnifer_row_col": "1,1", - "output_scale": "1,1", - "img_resolution": "-1,-1", - "magnifer_resolution": "-1,-1", - "magnifier_show_scale": "1,1", - "line_width": "2,2", - "magnifier_out_scale": "1,1", - "title_font_size": "20", - "box_position": 0, - "choice_normalized_size": 0, - "choice_output": 0, - "image_interp": 2, - "Magnifier_format": 1, - "title_font": 0, - "parallel_sequential": false, - "parallel_to_sequential": false, - "auto_save_all": false, - "move_file": false, - "img_vertical": false, - "one_img_vertical": false, - "img_unit_vertical": false, - "magnifer_vertical": true, - "show_original": true, - "show_magnifer": true, - "title_show": true, - "auto_layout_check": false, - "one_img": false, - "onetitle": false, - "customfunc": false, - "show_box": true, - "show_box_in_crop": true, - "select_img_box": false, - "title_auto": false, - "title_exif": false, - "title_show_parent": false, - "title_show_prefix": true, - "title_show_name": true, - "title_show_suffix": false, - "title_down_up": false -} + "row_col": "1,1", + "row_col_one_img": "1,1", + "show_scale": "1,1", + "row_col_img_unit": "3,1", + "gap": "10,10,5,5,3,3,2,2", + "magnifer_row_col": "1,1", + "output_scale": "1,1", + "img_resolution": "-1,-1", + "magnifer_resolution": "-1,-1", + "magnifier_show_scale": "-1,-1", + "line_width": "2,2", + "magnifier_out_scale": "1,1", + "title_font_size": "20", + "box_position": 0, + "choice_normalized_size": 0, + "choice_output": 0, + "image_interp": 2, + "Magnifier_format": 1, + "title_font": 0, + "parallel_sequential": false, + "parallel_to_sequential": false, + "auto_save_all": false, + "move_file": false, + "img_vertical": false, + "one_img_vertical": false, + "img_unit_vertical": false, + "magnifer_vertical": true, + "show_original": true, + "show_magnifer": true, + "title_show": true, + "auto_layout_check": false, + "one_img": false, + "onetitle": false, + "customfunc": false, + "show_box": true, + "show_box_in_crop": true, + "select_img_box": false, + "title_auto": false, + "title_exif": false, + "title_show_parent": false, + "title_show_prefix": true, + "title_show_name": true, + "title_show_suffix": false, + "title_down_up": false + } diff --git a/src/mulimgviewer/src/main.py b/src/mulimgviewer/src/main.py index bf69678..0a4155b 100644 --- a/src/mulimgviewer/src/main.py +++ b/src/mulimgviewer/src/main.py @@ -1033,7 +1033,6 @@ def set_img_layout(self): self.Magnifier_format.GetSelection()] # 34 def show_img(self): - if self.customfunc.Value and self.out_path_str == "": self.out_path(None) self.ImgManager.layout_params[33] = self.out_path_str @@ -1060,6 +1059,7 @@ def show_img(self): self.slider_value.SetValue(str(self.ImgManager.action_count)) self.slider_value_max.SetLabel( str(self.ImgManager.max_action_num-1)) + # Destroy the window to avoid memory leaks try: self.img_last.Destroy() @@ -1076,6 +1076,7 @@ def show_img(self): bmp_processed = self.process_by_custom_func() else: bmp_processed = None + flag = self.ImgManager.stitch_images( 0, copy.deepcopy(self.xy_magnifier)) if flag == 0: @@ -1085,6 +1086,7 @@ def show_img(self): self.show_bmp_in_panel = bmp self.img_size = bmp.size bmp = self.ImgManager.ImgF.PIL2wx(bmp) + self.img_panel.SetSize( wx.Size(self.img_size[0]+100, self.img_size[1]+100)) self.img_last = wx.StaticBitmap(parent=self.img_panel, @@ -1118,6 +1120,7 @@ def show_img(self): else: self.SetStatusText_( ["-1", str(self.ImgManager.action_count)+"/"+str(self.ImgManager.get_dir_num())+" dir", str(self.ImgManager.img_resolution[0])+"x"+str(self.ImgManager.img_resolution[1])+" pixels / "+self.ImgManager.get_stitch_name(), "-1"]) + if flag == 1: self.SetStatusText_( ["-1", str(self.ImgManager.action_count)+"/"+str(self.ImgManager.get_dir_num())+" dir", "***Error: "+str(self.ImgManager.name_list[self.ImgManager.action_count]) + ", during stitching images***", "-1"]) diff --git a/src/mulimgviewer/src/utils_img.py b/src/mulimgviewer/src/utils_img.py index 1044560..7a54393 100644 --- a/src/mulimgviewer/src/utils_img.py +++ b/src/mulimgviewer/src/utils_img.py @@ -581,9 +581,7 @@ def cal_txt_size_adjust_title(self, title_list, standard_size, font, font_size): str_ = str_ + "\n"+title[id:] k += 1 size_edit = draw.multiline_textbbox((0,0),str_, font) - size_edit = np.array(size_edit) - size_edit = size_edit.reshape(-1, 2) - title_size[i, :] = size_edit[0,:] + title_size[i, :] = size_edit split_num = split_num+1 if split_num > len(title): break @@ -993,10 +991,9 @@ def fill_func(self, img, id=None): def title_preprocessing(self, img, id): title_max_size = copy.deepcopy(self.title_max_size) - img = Image.new('RGBA', tuple(title_max_size), self.gap_color) draw = ImageDraw.Draw(img) - title_size = self.title_size[id*2+1, :] + title_size = self.title_size[id, :] delta_x = int((title_max_size[0]-title_size[0])/2) if self.title_setting[2]: # up