Skip to content

Commit

Permalink
fix bug: save img
Browse files Browse the repository at this point in the history
  • Loading branch information
nachifur committed Aug 22, 2021
1 parent 433808b commit 31972d0
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions utils_img.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,10 +964,6 @@ def img_preprocessing(self, img):

def crop_points_process(self, crop_points,title_up=False, img_mode=0):
"""img_mode, 0: show, 1: save"""
if title_up:
self.count_correct_crop_point = 1
else:
self.count_correct_crop_point = 0
crop_points_ = []
for crop_point_scale in crop_points:
crop_point = crop_point_scale[0:4]
Expand Down Expand Up @@ -1021,19 +1017,15 @@ def magnifier_preprocessing(self, img, img_mode=0, id=0):
img_list = []
for crop_point in self.crop_points:
crop_point = copy.deepcopy(crop_point)
if self.count_correct_crop_point ==1:
if self.layout_params[17][2]:
if self.vertical:
crop_point[0] = crop_point[0]-self.title_max_size[0]-self.layout_params[3][3]
crop_point[2] = crop_point[2]-self.title_max_size[0]-self.layout_params[3][3]
else:
crop_point[1] = crop_point[1]-self.title_max_size[1]-self.layout_params[3][3]
crop_point[3] = crop_point[3]-self.title_max_size[1]-self.layout_params[3][3]
if self.layout_params[17][2] and img_mode!=1:
if self.vertical:
crop_point[0] = crop_point[0]-self.title_max_size[0]-self.layout_params[3][3]
crop_point[2] = crop_point[2]-self.title_max_size[0]-self.layout_params[3][3]
else:
crop_point[1] = crop_point[1]-self.title_max_size[1]-self.layout_params[3][3]
crop_point[3] = crop_point[3]-self.title_max_size[1]-self.layout_params[3][3]
img_list.append(img.crop(tuple(crop_point)))

if self.layout_params[17][2]:
self.count_correct_crop_point = 0

gap = self.layout_params[3][4]

# get the size of magnifier img
Expand Down

0 comments on commit 31972d0

Please sign in to comment.