|
@@ -69,7 +69,7 @@ class GeneratePic(object):
|
|
|
one_line_pos=(x1, x2),
|
|
one_line_pos=(x1, x2),
|
|
|
line_color=(0, 0, 0),
|
|
line_color=(0, 0, 0),
|
|
|
line_thickness=20,
|
|
line_thickness=20,
|
|
|
- app=settings.app,
|
|
|
|
|
|
|
+ app=None,
|
|
|
crop_image_box=crop_image_box,
|
|
crop_image_box=crop_image_box,
|
|
|
)
|
|
)
|
|
|
print("66 制作蒙版")
|
|
print("66 制作蒙版")
|
|
@@ -140,8 +140,8 @@ class GeneratePic(object):
|
|
|
xunhuan = 0
|
|
xunhuan = 0
|
|
|
while k:
|
|
while k:
|
|
|
xunhuan += 1
|
|
xunhuan += 1
|
|
|
- if settings.app:
|
|
|
|
|
- settings.app.processEvents()
|
|
|
|
|
|
|
+ # if settings.app:
|
|
|
|
|
+ # settings.app.processEvents()
|
|
|
k -= 1
|
|
k -= 1
|
|
|
Midtones += 0.035
|
|
Midtones += 0.035
|
|
|
if Midtones > 1.7:
|
|
if Midtones > 1.7:
|
|
@@ -222,7 +222,7 @@ class GeneratePic(object):
|
|
|
one_line_pos=(x1, x2),
|
|
one_line_pos=(x1, x2),
|
|
|
line_color=(0, 0, 0),
|
|
line_color=(0, 0, 0),
|
|
|
line_thickness=20,
|
|
line_thickness=20,
|
|
|
- app=settings.app,
|
|
|
|
|
|
|
+ app=None,
|
|
|
crop_image_box=(x1, y1, x2, y2),
|
|
crop_image_box=(x1, y1, x2, y2),
|
|
|
)
|
|
)
|
|
|
print("66 制作蒙版")
|
|
print("66 制作蒙版")
|
|
@@ -290,8 +290,8 @@ class GeneratePic(object):
|
|
|
print("循环识别")
|
|
print("循环识别")
|
|
|
while k:
|
|
while k:
|
|
|
print("循环识别:{}".format(k))
|
|
print("循环识别:{}".format(k))
|
|
|
- if settings.app:
|
|
|
|
|
- settings.app.processEvents()
|
|
|
|
|
|
|
+ # if settings.app:
|
|
|
|
|
+ # settings.app.processEvents()
|
|
|
k -= 1
|
|
k -= 1
|
|
|
Midtones += 0.1
|
|
Midtones += 0.1
|
|
|
if Midtones > 1:
|
|
if Midtones > 1:
|
|
@@ -556,38 +556,48 @@ class GeneratePic(object):
|
|
|
if settings.OUT_PIC_FACTOR > 1.0:
|
|
if settings.OUT_PIC_FACTOR > 1.0:
|
|
|
print("图片锐化处理")
|
|
print("图片锐化处理")
|
|
|
image_bg = sharpen_image(image_bg, factor=settings.OUT_PIC_FACTOR)
|
|
image_bg = sharpen_image(image_bg, factor=settings.OUT_PIC_FACTOR)
|
|
|
-
|
|
|
|
|
- if out_pic_size < 1600:
|
|
|
|
|
- image_bg = image_bg.resize(
|
|
|
|
|
- (out_pic_size, out_pic_size), resample=settings.RESIZE_IMAGE_MODE
|
|
|
|
|
- )
|
|
|
|
|
-
|
|
|
|
|
- if settings.OUT_PIC_MODE == ".jpg":
|
|
|
|
|
- if settings.OUT_PIC_QUALITY == "普通":
|
|
|
|
|
- self.saver.save_image(
|
|
|
|
|
- image=image_bg,
|
|
|
|
|
- file_path=out_path,
|
|
|
|
|
- save_mode="jpg",
|
|
|
|
|
- quality=None,
|
|
|
|
|
- dpi=None,
|
|
|
|
|
- _format="JPEG",
|
|
|
|
|
|
|
+ for imageSize in out_pic_size:
|
|
|
|
|
+ dot_index = out_path.rfind(".")
|
|
|
|
|
+ if dot_index != -1:
|
|
|
|
|
+ # 拆分文件路径和后缀
|
|
|
|
|
+ file_without_suffix = out_path[:dot_index]
|
|
|
|
|
+ suffix = out_path[dot_index + 1 :]
|
|
|
|
|
+ else:
|
|
|
|
|
+ file_without_suffix = out_path
|
|
|
|
|
+ suffix = ""
|
|
|
|
|
+ # 单独拼接字符串示例
|
|
|
|
|
+ new_file_path = f"{file_without_suffix}_{imageSize}.{suffix}"
|
|
|
|
|
+ if imageSize < 1600:
|
|
|
|
|
+ image_bg = image_bg.resize(
|
|
|
|
|
+ (out_pic_size, out_pic_size), resample=settings.RESIZE_IMAGE_MODE
|
|
|
)
|
|
)
|
|
|
- # save_image_by_thread(image_bg, out_path, save_mode="jpg", quality=None, dpi=None, _format="JPEG")
|
|
|
|
|
- # image_bg.save(out_path, format="JPEG")
|
|
|
|
|
|
|
+ if settings.OUT_PIC_MODE == ".jpg":
|
|
|
|
|
+ self.saver.save_image(
|
|
|
|
|
+ image=image_bg,
|
|
|
|
|
+ file_path=new_file_path,
|
|
|
|
|
+ save_mode="jpg",
|
|
|
|
|
+ quality=None,
|
|
|
|
|
+ dpi=None,
|
|
|
|
|
+ _format="JPEG",
|
|
|
|
|
+ )
|
|
|
|
|
+ # save_image_by_thread(image_bg, out_path, save_mode="jpg", quality=None, dpi=None, _format="JPEG")
|
|
|
|
|
+ # image_bg.save(out_path, format="JPEG")
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.saver.save_image(
|
|
|
|
|
+ image=image_bg,
|
|
|
|
|
+ file_path=new_file_path,
|
|
|
|
|
+ save_mode="jpg",
|
|
|
|
|
+ quality=100,
|
|
|
|
|
+ dpi=(300, 300),
|
|
|
|
|
+ _format="JPEG",
|
|
|
|
|
+ )
|
|
|
|
|
+ # save_image_by_thread(image_bg, out_path, save_mode="jpg", quality=100, dpi=(300, 300), _format="JPEG")
|
|
|
|
|
+ # image_bg.save(out_path, quality=100, dpi=(300, 300), format="JPEG")
|
|
|
else:
|
|
else:
|
|
|
self.saver.save_image(
|
|
self.saver.save_image(
|
|
|
- image=image_bg,
|
|
|
|
|
- file_path=out_path,
|
|
|
|
|
- save_mode="jpg",
|
|
|
|
|
- quality=100,
|
|
|
|
|
- dpi=(300, 300),
|
|
|
|
|
- _format="JPEG",
|
|
|
|
|
|
|
+ image=image_bg, file_path=new_file_path, save_mode="png"
|
|
|
)
|
|
)
|
|
|
- # save_image_by_thread(image_bg, out_path, save_mode="jpg", quality=100, dpi=(300, 300), _format="JPEG")
|
|
|
|
|
- # image_bg.save(out_path, quality=100, dpi=(300, 300), format="JPEG")
|
|
|
|
|
- else:
|
|
|
|
|
- self.saver.save_image(image=image_bg, file_path=out_path, save_mode="png")
|
|
|
|
|
- # image_bg.save(out_path)
|
|
|
|
|
|
|
+ # image_bg.save(out_path)
|
|
|
|
|
|
|
|
if output_queue is not None:
|
|
if output_queue is not None:
|
|
|
output_queue.put(True)
|
|
output_queue.put(True)
|