Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "图片文字不居中" #118

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 45 additions & 45 deletions output.json
Original file line number Diff line number Diff line change
@@ -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
}
5 changes: 4 additions & 1 deletion src/mulimgviewer/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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:
Expand All @@ -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,
Expand Down Expand Up @@ -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"])
Expand Down
7 changes: 2 additions & 5 deletions src/mulimgviewer/src/utils_img.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down