|
|
@@ -71,6 +71,8 @@ class DetailPicGet(DetailBase):
|
|
|
self.deal_pic_4,
|
|
|
self.deal_pic_5,
|
|
|
self.deal_pic_6,
|
|
|
+ self.deal_pic_7,
|
|
|
+ self.deal_pic_8,
|
|
|
]
|
|
|
if test:
|
|
|
self.run_test()
|
|
|
@@ -85,6 +87,8 @@ class DetailPicGet(DetailBase):
|
|
|
detailed_images.append(self.deal_pic_4())
|
|
|
detailed_images.append(self.deal_pic_5())
|
|
|
detailed_images.append(self.deal_pic_6())
|
|
|
+ detailed_images.append(self.deal_pic_7())
|
|
|
+ detailed_images.append(self.deal_pic_8())
|
|
|
img = self.add_pic(detailed_images)
|
|
|
if img:
|
|
|
self.create_folder(r"{}/{}".format(self.out_put_dir, template_name))
|
|
|
@@ -373,10 +377,153 @@ class DetailPicGet(DetailBase):
|
|
|
detailed_images.append(bg_image)
|
|
|
|
|
|
return PictureProcessing(im=self.add_pic(detailed_images))
|
|
|
+ # 场景图--产品展示
|
|
|
+ def deal_pic_7(self):
|
|
|
+ detailed_images = []
|
|
|
+ top_image = PictureProcessing(r"{}\7.jpg".format(self.root))
|
|
|
+ text_fill = (0, 0, 0)
|
|
|
+ font_title = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 60)
|
|
|
+ font_sub = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 40)
|
|
|
+ detailed_images.append(top_image)
|
|
|
+ goods_art_no_list = list(self.data.keys())
|
|
|
+ for goods_info in goods_art_no_list:
|
|
|
+ pp_jpg_1_list = []
|
|
|
+ pp_png_1_list = []
|
|
|
+ for goods_item in goods_art_no_list:
|
|
|
+ pp_jpg, pp_png = self.image_one_pic(
|
|
|
+ return_orign=True,
|
|
|
+ goods_art_no=goods_item,
|
|
|
+ name="俯视",
|
|
|
+ )
|
|
|
+ pp_jpg_1_list.append(pp_jpg)
|
|
|
+ pp_png_1_list.append(pp_png)
|
|
|
+ x, y = 0, 0
|
|
|
+ pp_bg_jpg = PictureProcessing("RGB", (1600, 1600), (255, 255, 255))
|
|
|
+ _resize_value = (
|
|
|
+ top_image.width if len(pp_jpg_1_list) == 1 else top_image.width - 300
|
|
|
+ )
|
|
|
+
|
|
|
+ for index, pp_jpg in enumerate(pp_jpg_1_list):
|
|
|
+ pp_jpg = pp_jpg.resize(value=_resize_value + 100 * index)
|
|
|
+ pp_bg_jpg = pp_bg_jpg.to_overlay_pic_advance(top_img=pp_jpg, value=(x, y))
|
|
|
+ x += 180
|
|
|
+ y += 60
|
|
|
+
|
|
|
+ x, y = 0, 0
|
|
|
+ pp_bg_png = PictureProcessing("RGBA", (1600, 1600), (255, 255, 255, 0))
|
|
|
+ for index, pp_png in enumerate(pp_png_1_list):
|
|
|
+ pp_png = pp_png.resize(value=_resize_value + 100 * index)
|
|
|
+ pp_bg_png = pp_bg_png.paste_img(top_img=pp_png, value=(x, y))
|
|
|
+ x += 180
|
|
|
+ y += 60
|
|
|
+
|
|
|
+ min_bbox = pp_bg_png.getbbox()
|
|
|
+ min_bbox = PictureProcessing().expand_bbox(min_bbox)
|
|
|
+ pp_bg_jpg = pp_bg_jpg.crop(bbox=min_bbox)
|
|
|
+ pp_bg_png = pp_bg_png.crop(bbox=min_bbox)
|
|
|
+ pp_bg_1 = PictureProcessing(
|
|
|
+ "RGB", (top_image.width, pp_bg_jpg.height), (255, 255, 255)
|
|
|
+ )
|
|
|
+ pp_bg_1 = pp_bg_1.to_overlay_pic_advance(
|
|
|
+ top_img=pp_bg_jpg, top_png_img=pp_bg_png, base="cc"
|
|
|
+ )
|
|
|
+ pp_text_title = PictureProcessing().get_text_image_advanced(
|
|
|
+ font=font_title,
|
|
|
+ text="45°侧视/SIDE",
|
|
|
+ fill=text_fill,
|
|
|
+ return_mode="min_image",
|
|
|
+ )
|
|
|
+ pp_bg_1.paste_img(top_img=pp_text_title, base="cs", value=(0, 0))
|
|
|
+ color_pic_list_1 = []
|
|
|
+ pp_jpg_ceshi, pp_png_ceshi = self.image_one_pic(
|
|
|
+ return_orign=True,
|
|
|
+ goods_art_no=goods_item,
|
|
|
+ name="侧视",
|
|
|
+ )
|
|
|
+ pp_jpg_hougen, pp_png_hougen = self.image_one_pic(
|
|
|
+ return_orign=True,
|
|
|
+ goods_art_no=goods_item,
|
|
|
+ name="后跟",
|
|
|
+ )
|
|
|
+ pp_jpg_neili, pp_png_neili = self.image_one_pic(
|
|
|
+ return_orign=True,
|
|
|
+ goods_art_no=goods_item,
|
|
|
+ name="内里",
|
|
|
+ )
|
|
|
+ pp_jpg_xiedi, pp_png_xiedi = self.image_one_pic(
|
|
|
+ return_orign=True,
|
|
|
+ goods_art_no=goods_item,
|
|
|
+ name="鞋底",
|
|
|
+ )
|
|
|
+ pp_png_ceshi = pp_png_ceshi.resize(value=pp_bg_jpg.width / 3)
|
|
|
+ text_image = PictureProcessing().get_text_image_advanced(
|
|
|
+ font=font_sub,
|
|
|
+ text="180°侧面/SIDE",
|
|
|
+ fill=(0, 0, 0),
|
|
|
+ return_mode="min_image",
|
|
|
+ )
|
|
|
+ backImage = PictureProcessing("RGB", (top_image.width/2, 400), (255, 255, 255))
|
|
|
+ backImage.paste_img(top_img=text_image, base="cs", value=(0, 0))
|
|
|
+ backImage.paste_img(top_img=pp_png_ceshi, base="cs", value=(0, 30))
|
|
|
+ color_pic_list_1.append(backImage)
|
|
|
+ pp_png_hougen = pp_png_hougen.resize(value=pp_bg_jpg.width / 4)
|
|
|
+ text_image = PictureProcessing().get_text_image_advanced(
|
|
|
+ font=font_sub,
|
|
|
+ text="背面/BACK",
|
|
|
+ fill=(0, 0, 0),
|
|
|
+ return_mode="min_image",
|
|
|
+ )
|
|
|
+ backImage = PictureProcessing(
|
|
|
+ "RGB", (top_image.width / 2, 400), (255, 255, 255)
|
|
|
+ )
|
|
|
+ backImage.paste_img(top_img=text_image, base="cs", value=(0, 0))
|
|
|
+ backImage.paste_img(top_img=pp_png_hougen, base="cs", value=(0, 40))
|
|
|
+ color_pic_list_1.append(backImage)
|
|
|
+ pp_png_neili = pp_png_neili.resize(value=pp_bg_jpg.width / 3)
|
|
|
+ text_image = PictureProcessing().get_text_image_advanced(
|
|
|
+ font=font_sub,
|
|
|
+ text="鞋面/VAMP",
|
|
|
+ fill=(0, 0, 0),
|
|
|
+ return_mode="min_image",
|
|
|
+ )
|
|
|
+ backImage = PictureProcessing(
|
|
|
+ "RGB", (top_image.width / 2, 400), (255, 255, 255)
|
|
|
+ )
|
|
|
+ backImage.paste_img(top_img=text_image, base="cs", value=(-10, 0))
|
|
|
+ backImage.paste_img(top_img=pp_png_neili, base="cs", value=(-10, 30))
|
|
|
+ color_pic_list_1.append(backImage)
|
|
|
+ pp_png_xiedi = pp_png_xiedi.resize(value=pp_bg_jpg.width / 3)
|
|
|
+ text_image = PictureProcessing().get_text_image_advanced(
|
|
|
+ font=font_sub,
|
|
|
+ text="鞋底/BOTTOM",
|
|
|
+ fill=(0, 0, 0),
|
|
|
+ return_mode="min_image",
|
|
|
+ )
|
|
|
+ backImage = PictureProcessing(
|
|
|
+ "RGB", (top_image.width / 2, 400), (255, 255, 255)
|
|
|
+ )
|
|
|
+ backImage.paste_img(top_img=text_image, base="cs", value=(0, 0))
|
|
|
+ backImage.paste_img(top_img=pp_png_xiedi, base="cs", value=(0, 30))
|
|
|
+ color_pic_list_1.append(backImage)
|
|
|
+ all_color_pp = PictureProcessing(
|
|
|
+ "RGB", (top_image.width, 1600), (255, 255, 255)
|
|
|
+ ).horizontal_distribution(
|
|
|
+ color_pic_list_1,
|
|
|
+ bg_width=top_image.width,
|
|
|
+ line_spacing=10,
|
|
|
+ number_per_row=2,
|
|
|
+ )
|
|
|
+ detailed_images.append(pp_bg_1)
|
|
|
+ detailed_images.append(all_color_pp)
|
|
|
+ bottomImage = PictureProcessing(
|
|
|
+ "RGB", (top_image.width, 200), (255, 255, 255)
|
|
|
+ )
|
|
|
+ detailed_images.append(bottomImage)
|
|
|
+
|
|
|
+ return PictureProcessing(im=self.add_pic(detailed_images))
|
|
|
|
|
|
# # 添加注意事项
|
|
|
- # def deal_pic_6(self):
|
|
|
- # detailed_images = []
|
|
|
- # detailed_images.append(PictureProcessing(r"{}\20.jpg".format(self.root)))
|
|
|
- # detailed_images.append(PictureProcessing(r"{}\21.jpg".format(self.root)))
|
|
|
- # return PictureProcessing(im=self.add_pic(detailed_images))
|
|
|
+ def deal_pic_8(self):
|
|
|
+ detailed_images = []
|
|
|
+ detailed_images.append(PictureProcessing(r"{}\10.jpg".format(self.root)))
|
|
|
+ return PictureProcessing(im=self.add_pic(detailed_images))
|