|
|
@@ -55,9 +55,6 @@ class GeneratePic(object):
|
|
|
# 在鞋底最低处增加一条直线蒙版,蒙版宽度为有效区域大小
|
|
|
image_high = im_jpg.height
|
|
|
print("图片高度:", image_high)
|
|
|
- # TODO 待移除
|
|
|
- if settings.app:
|
|
|
- settings.app.processEvents()
|
|
|
cv2_jpg = pil_to_cv2(im_jpg)
|
|
|
|
|
|
# 返回线条图片,以及最低位置
|
|
|
@@ -75,12 +72,9 @@ class GeneratePic(object):
|
|
|
one_line_pos=(x1, x2),
|
|
|
line_color=(0, 0, 0),
|
|
|
line_thickness=20,
|
|
|
- app=settings.app,
|
|
|
+ app=None,
|
|
|
crop_image_box=crop_image_box,
|
|
|
)
|
|
|
- # TODO 待移除
|
|
|
- if settings.app:
|
|
|
- settings.app.processEvents()
|
|
|
print("66 制作蒙版")
|
|
|
# 制作蒙版
|
|
|
mask_line = cv2_to_pil(img_with_shifted_line)
|
|
|
@@ -105,17 +99,11 @@ class GeneratePic(object):
|
|
|
mask.paste(white_bg, mask=green_areas_mask_pil.convert("L"))
|
|
|
mask = mask.convert("L")
|
|
|
|
|
|
- # TODO 待移除
|
|
|
- if settings.app:
|
|
|
- settings.app.processEvents()
|
|
|
# ====================生成新的图片
|
|
|
print("84 生成新的图片")
|
|
|
bg = Image.new(mode="RGBA", size=im_png.size, color=(255, 255, 255, 255))
|
|
|
bg.paste(im_png, mask=im_png)
|
|
|
bg.paste(im_jpg, mask=mask) # 粘贴有阴影的地方
|
|
|
- # TODO 待移除
|
|
|
- if settings.app:
|
|
|
- settings.app.processEvents()
|
|
|
if self.is_test:
|
|
|
_bg = bg.copy()
|
|
|
draw = ImageDraw.Draw(_bg)
|
|
|
@@ -155,8 +143,6 @@ class GeneratePic(object):
|
|
|
xunhuan = 0
|
|
|
while k:
|
|
|
xunhuan += 1
|
|
|
- if settings.app:
|
|
|
- settings.app.processEvents()
|
|
|
k -= 1
|
|
|
Midtones += 0.035
|
|
|
if Midtones > 1.7:
|
|
|
@@ -416,6 +402,7 @@ class GeneratePic(object):
|
|
|
print("242 need_time_1:{}".format(time.time() - _s))
|
|
|
|
|
|
orign_x, orign_y = orign_im.size
|
|
|
+ time.sleep(1)
|
|
|
cut_image = Image.open(cut_image_path) # 原始图的已扣图
|
|
|
cut_image, new_box = get_mini_crop_img(img=cut_image)
|
|
|
im_shadow = orign_im.crop(new_box) # 切图
|