rambo 5 päivää sitten
vanhempi
commit
10650d4654

+ 4 - 1
python/api.py

@@ -145,7 +145,7 @@ async def forwardRequest(request: HlmForwardRequest):
 def __createExcelGoodsArray(excel_path):
     '''创建通过excel形式得货号组数据'''
     try:
-        excel_df = pd.read_excel(excel_path, sheet_name=0, header=0)
+        excel_df = pd.read_excel(excel_path, sheet_name=0, header=0, dtype={"款号": str})
         if "商品货号" not in excel_df.columns:
             raise UnicornException("缺失 [商品货号] 列")
         if "款号" not in excel_df.columns:
@@ -159,12 +159,15 @@ def __createExcelGoodsArray(excel_path):
             goods_art_no = str(goods_row["商品货号"])
             goods_art_no_arrays.append(goods_art_no)
             goods_no = str(goods_row["款号"])
+            print("a001_df   goods_no",goods_no)
             a001_df = goods_art_dirs.get_group(goods_no)
+            print("a001_df",a001_df)
             goods_art_groups = a001_df["商品货号"].tolist()
             if goods_art_groups in goods_art_no_group_arrays:
                 continue
             goods_art_no_group_arrays.append(goods_art_groups)
     except Exception as e:
+        print("exce",e)
         raise UnicornException("Excel文件解析失败,请检查是否缺少列")
     return goods_art_no_arrays,excel_df,goods_art_no_group_arrays
 

+ 456 - 279
python/custom_plugins/plugins/detail_template/xiaosushuoxie/detail_xiaosushuoxie7.py

@@ -39,12 +39,19 @@ class DetailPicGet(DetailBase):
         self.template_name = template_name
         self.base_bg_color = (236, 226, 211)
         self.white_bg_color = (255, 255, 255)
+        self.black_bg_color = (0, 0, 0)
         self.deal_pic_func_list = [
             self.deal_pic_1,
-            # self.deal_pic_2,
-            # self.deal_pic_3,
-            # self.deal_pic_4,
-            # self.deal_pic_5,
+            self.deal_pic_2,
+            self.deal_pic_3,
+            self.deal_pic_4,
+            self.deal_pic_5,
+            self.deal_pic_6,
+            self.deal_pic_7,
+            self.deal_pic_8,
+            self.deal_pic_9,
+            self.deal_pic_10,
+            self.deal_pic_11,
         ]
 
         if test:
@@ -56,17 +63,23 @@ class DetailPicGet(DetailBase):
     def run_test(self):
         detailed_images = []
         detailed_images.append(self.deal_pic_1())
-        # detailed_images.append(self.deal_pic_2())
-        # detailed_images.append(self.deal_pic_3())
-        # detailed_images.append(self.deal_pic_4())
-        # detailed_images.append(self.deal_pic_5())
+        detailed_images.append(self.deal_pic_2())
+        detailed_images.append(self.deal_pic_3())
+        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())
+        detailed_images.append(self.deal_pic_9())
+        detailed_images.append(self.deal_pic_10())
+        detailed_images.append(self.deal_pic_11())
         img = self.add_pic(detailed_images)
         img.save(r"{}/{}.jpg".format(self.out_put_dir,self.goods_no, format="JPEG"))
 
     def deal_pic_1(self):
         """   制作主图  """
         detailed_images = []
-        pp_bg = PictureProcessing(r"{}\template_1.jpg".format(self.root))
+        pp_bg = PictureProcessing(r"{}\first_bg.png".format(self.root))
         # -------粘贴文字-------
         mainTitle = self.get_text_value("主标题")
         subTitle = self.get_text_value("副标题")
@@ -109,6 +122,12 @@ class DetailPicGet(DetailBase):
         pp_bg = pp_bg.paste_img(top_img=main_text_bg,value=(0,208),base='nc')
         pp_bg = pp_bg.paste_img(top_img=sub_text_bg,value=(0,470),base='nc')
         pp_bg = pp_bg.paste_img(top_img=sign_text_bg,value=(0,57),base='nc')
+        bottom_bg = PictureProcessing(
+            r"{}\bolang.png".format(
+                self.root
+            )
+        )
+        pp_bg.paste_img(top_img=bottom_bg, value=(0, 0),base='cs')
         detailed_images.append(pp_bg)
         return PictureProcessing(im=self.add_pic(detailed_images))
 
@@ -118,44 +137,392 @@ class DetailPicGet(DetailBase):
         """
         # 文字排列
         detailed_images = []
-        pp_bg = PictureProcessing(
-            r"{}\template_2.png".format(
+        top_bg = PictureProcessing(
+            r"{}\bolang.png".format(
                 self.root
             )
         )
-        detailed_images.append(pp_bg)
-
-
+        # detailed_images.append(top_bg)
+        designText1 = self.get_text_value("设计理念1")
+        designText2 = self.get_text_value("设计理念2")
+        designText3 = self.get_text_value("设计理念3")
+        fontSub = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 60)
+        centerDesign = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 65)
+        first_text_bg = PictureProcessing("RGB", (top_bg.width, 90), self.white_bg_color)
+        first_text_bg = first_text_bg.get_text_image_advanced(
+                value=(0, 0),
+                font=fontSub,
+                text=designText1,
+                align="center",
+                fill=self.black_bg_color,
+                return_mode="min_image",
+            )
+        temp_text_bg = PictureProcessing("RGB", (top_bg.width, 90), self.white_bg_color)
+        temp_text_bg = temp_text_bg.paste_img(top_img=first_text_bg,value=(0,0),base='cc')
+        detailed_images.append(temp_text_bg)
+        second_text_bg = PictureProcessing("RGB", (top_bg.width, 90), self.white_bg_color)
+        second_text_bg = second_text_bg.get_text_image_advanced(
+                value=(0, 0),
+                font=centerDesign,
+                text=designText2,
+                align="center",
+                fill=self.black_bg_color,
+                return_mode="min_image",
+            )
+        temp_text_bg = PictureProcessing("RGB", (top_bg.width, 90), self.white_bg_color)
+        temp_text_bg = temp_text_bg.paste_img(top_img=second_text_bg,value=(0,0),base='cc')
+        detailed_images.append(temp_text_bg)
+        third_text_bg = PictureProcessing("RGB", (top_bg.width, 90), self.white_bg_color)
+        third_text_bg = third_text_bg.get_text_image_advanced(
+                value=(0, 0),
+                font=fontSub,
+                text=designText3,
+                align="center",
+                fill=self.black_bg_color,
+                return_mode="min_image",
+            )
+        temp_text_bg = PictureProcessing("RGB", (top_bg.width, 90), self.white_bg_color)
+        temp_text_bg = temp_text_bg.paste_img(top_img=third_text_bg,value=(0,0),base='cc')
+        detailed_images.append(temp_text_bg)
+        temp_text_bg = PictureProcessing("RGB", (top_bg.width, 90), self.white_bg_color)
+        detailed_images.append(temp_text_bg)
+        # 卡片
+        pp_list_1 = []
+        font = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 60)
+        fontEN = ImageFont.truetype(r"resources\ttf\puhui\en\Medium.otf", 30)
         goods_art_no_list = list(self.data.keys())
-
-        pp_1 = self.get_overlay_pic_from_dict(
-            goods_art_no=goods_art_no_list[0],
-            color_name="侧视",
-            bg_color=self.base_bg_color,
+        pp_jpg = self.get_overlay_pic_from_dict(
+                goods_art_no=goods_art_no_list[0],
+                color_name="俯视",
+                bg_color=self.white_bg_color,
+            )
+        pp_jpg = pp_jpg.resize(value=840)
+        text_array = [{"title":self.get_text_value("鞋跟描述")
+                       ,"bottom":"Comfortable heel","position":(-200, 0)},
+                      {"title":self.get_text_value("鞋头描述"),
+                       "position":(200, 0),"bottom":"Versatile Upper"}]
+        for index, item in enumerate(text_array):
+            text_bg = PictureProcessing("RGBA", (440, 200), (255, 255, 255,0))
+            text_bg = text_bg.get_text_image_advanced(
+                value=(0, 0),
+                font=font,
+                text="{}".format(item["title"]),
+                align="center",
+                spacing=15,
+                fill=(255, 255, 255),
+                return_mode="min_image",
+                margins=(10, 5, 0, 0),
+                max_len_one_line=6
+            )
+            _bg = PictureProcessing("RGB", (520, 880), (208, 186, 162))
+            _bg = _bg.radius(circular_pos=(1, 1, 1, 1), value=60)
+            _bg = _bg.paste_img(top_img=text_bg, value=(0, 50),base='nc')
+            text_bottome = PictureProcessing("RGBA", (440, 200), (255, 255, 255,0))
+            text_bottome = text_bottome.get_text_image_advanced(
+                value=(0, 0),
+                font=fontEN,
+                text="{}".format(item["bottom"]),
+                align="center",
+                spacing=15,
+                fill=(255, 255, 255),
+                return_mode="min_image",
+                margins=(10, 5, 0, 0),
+            )
+            _bg = _bg.paste_img(top_img=text_bottome, value=(0, 50),base='cs')
+            # 第一张图
+            first_imageBg = PictureProcessing("RGB", (420, 600), self.white_bg_color)
+            first_imageBg.paste_img(top_img=pp_jpg, value=item["position"], base='cc')
+            _bg = _bg.paste_img(top_img=first_imageBg, value=(0, 0),base='cc')
+            pp_list_1.append(_bg)
+        rows = 2
+        shoes_bg = PictureProcessing().horizontal_distribution(
+            pp_list=pp_list_1,
+            bg_width=top_bg.width,
+            margins=(0, 0, 50, 50),
+            line_spacing=60,
+            number_per_row=rows,
         )
-        pp_1= pp_1.resize(value=pp_bg.width / 1.4)
-        pp_1= pp_1.paste_img_invert(top_img=PictureProcessing("RGB", (pp_bg.width, pp_1.height + 40), self.base_bg_color),
-                                    base="cc"
-                                    )
-        detailed_images.append(pp_1)
-
-        pp_bg_bottom = PictureProcessing(r"{}\template_2_1.png".format(self.root))
-        detailed_images.append(pp_bg_bottom)
+        detailed_images.append(shoes_bg)
+        
+        temp_text_bg = PictureProcessing("RGB", (top_bg.width, 90), self.white_bg_color)
+        detailed_images.append(temp_text_bg)
         return PictureProcessing(im=self.add_pic(detailed_images))
-
     def deal_pic_3(self):
-        """   各个颜色细节展示  """
         detailed_images = []
         pp_bg = PictureProcessing(
-            r"{}\template_3.png".format(
+            r"{}\template_4.jpg".format(
                 self.root
             )
         )
+        _bg = PictureProcessing("RGB", (pp_bg.width*0.8, pp_bg.height*0.8), self.white_bg_color)
+        _bg = _bg.radius(circular_pos=(1, 1, 1, 1), value=60)
+        font1 = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 100)
+        font2 = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 50)
+        text_bg = PictureProcessing("RGB", (440, 200), (255, 255, 255))
+        text1 = self.get_text_value("面料FAB1")
+        if not text1:
+            text1 = "轻盈透气"
+        text_bg = text_bg.get_text_image_advanced(
+            value=(0, 0),
+            font=font1,
+            text=text1,
+            align="left",
+            spacing=5,
+            fill=(194, 189, 167),
+            return_mode="min_image",
+        )
+        _bg.paste_img(top_img=text_bg, value=(50, 40),base='nw')
+        # text2
+        text2 = self.get_text_value("面料FAB2")
+        if not text2:
+            text2 = "(软弹不易累脚)"
+        text_bg2 = PictureProcessing("RGB", (440, 200), (255, 255, 255))
+        text_bg2 = text_bg2.get_text_image_advanced(
+            value=(0, 0),
+            font=font2,
+            text=text2,
+            align="left",
+            spacing=5,
+            fill=(194, 189, 167),
+            return_mode="min_image",
+        )
+        _bg.paste_img(top_img=text_bg2, value=(50, 140),base='en')
+        pp_bg = pp_bg.paste_img(top_img=_bg, value=(0, 0),base='cc')
         detailed_images.append(pp_bg)
-
-
-        # ----------主图放置
-        y = 120
+        return PictureProcessing(im=self.add_pic(detailed_images))
+    def deal_pic_4(self):
+        # =============设计理念================
+        detail_images = []
+        top_bg = PictureProcessing(r"{}\template_5.jpg".format(self.root))
+        goods_art_no_list = list(self.data.keys())
+        pp_jpg, pp_png = self.image_one_pic(return_orign=True,
+                                                goods_art_no=goods_art_no_list[0],
+                                                name="俯视",
+                                                )
+        pp_jpg = pp_jpg.resize(value=round(top_bg.width*0.8))
+        pp_png = pp_png.resize(value=round(top_bg.width*0.8))
+        top_bg = top_bg.to_overlay_pic_advance(top_img=pp_jpg, top_png_img=pp_png, base="cc",value=(0, 0))
+        # 
+        textTitle1 = self.get_text_value("材质FAB1")
+        textTitle2 = self.get_text_value("材质FAB2")
+        font = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 100)
+        font2 = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 60)
+        font3 = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 50)
+        titleBg = PictureProcessing("RGB", (top_bg.width, 200), (255, 255, 255))
+        titleBg = titleBg.get_text_image_advanced(
+            value=(0, 0),
+            font=font,
+            text=textTitle1,
+            align="left",
+            spacing=5,
+            fill=(53, 49, 48),
+            return_mode="min_image",
+        )
+        top_bg.paste_img(top_img=titleBg, value=(0, 100),base='nc')
+        text_bg2 = PictureProcessing("RGB", (top_bg.width, 200), (255, 255, 255))
+        text_bg2 = titleBg.get_text_image_advanced(
+            value=(0, 0),
+            font=font2,
+            text=textTitle2,
+            align="left",
+            spacing=5,
+            fill=(53, 49, 48),
+            return_mode="min_image",
+        )
+        top_bg.paste_img(top_img=text_bg2, value=(0, 230),base='nc')
+        textTitle3 = self.get_text_value("材质FAB3")
+        text_bg3 = PictureProcessing("RGB", (top_bg.width, 200), (255, 255, 255))
+        text_bg3 = text_bg3.get_text_image_advanced(
+            value=(0, 0),
+            font=font3,
+            text=textTitle3,
+            align="center",
+            spacing=5,
+            fill=(53, 49, 48),
+            return_mode="min_image",
+            max_len_one_line=4
+        )
+        top_bg.paste_img(top_img=text_bg3, value=(154, 1325),base='nw')
+        textTitle4 = self.get_text_value("材质FAB4")
+        text_bg4 = PictureProcessing("RGB", (top_bg.width, 200), (255, 255, 255))
+        text_bg4 = text_bg4.get_text_image_advanced(
+            value=(0, 0),
+            font=font3,
+            text=textTitle4,
+            align="center",
+            spacing=5,
+            fill=(53, 49, 48),
+            return_mode="min_image",
+            max_len_one_line=4
+        )
+        top_bg.paste_img(top_img=text_bg4, value=(0, 1325),base='nc')
+        textTitle5 = self.get_text_value("材质FAB5")
+        text_bg5 = PictureProcessing("RGB", (top_bg.width, 200), (255, 255, 255))
+        text_bg5 = text_bg5.get_text_image_advanced(
+            value=(0, 0),
+            font=font3,
+            text=textTitle5,
+            align="center",
+            spacing=5,
+            fill=(53, 49, 48),
+            return_mode="min_image",
+            max_len_one_line=4
+        )
+        top_bg.paste_img(top_img=text_bg5, value=(154, 1325),base='en')
+        detail_images.append(top_bg)
+        return PictureProcessing(im=self.add_pic(detail_images))
+    def deal_pic_5(self):
+        detailed_images = []
+        goods_art_no_list = list(self.data.keys())
+        top_bg = PictureProcessing(
+            r"{}\template_6.jpg".format(
+                self.root
+            )
+        )
+        detailed_images.append(top_bg)
+        return self.pp_pic_subsection(PictureProcessing(im=self.add_pic(detailed_images)))
+    def deal_pic_6(self):
+        detailed_images = []
+        goods_art_no_list = list(self.data.keys())
+        top_bg = PictureProcessing(
+            r"{}\template_7.jpg".format(
+                self.root
+            )
+        )
+        detailed_images.append(top_bg)
+        shoesBg = PictureProcessing("RGB", (top_bg.width, 600), self.white_bg_color)
+        pp_jpg = self.get_overlay_pic_from_dict(
+                goods_art_no=goods_art_no_list[0],
+                color_name="俯视",
+                bg_color=self.white_bg_color,
+            )
+        _, pp_png = self.image_one_pic(return_orign=True,
+                                                goods_art_no=goods_art_no_list[0],
+                                                name="俯视",
+                                                )
+        pp_png = pp_png.resize(value=(600))
+        pp_jpg = pp_jpg.resize(value=(600))
+        hengxian = PictureProcessing(
+            r"{}\hengxian.png".format(
+                self.root
+            )
+        )
+        shuxian = PictureProcessing(
+            r"{}\shuxian.png".format(
+                self.root
+            )
+        )
+        bbox = pp_png.get_im().getbbox()
+        cropped_img = pp_png.get_im().crop(bbox)
+        hengxian = hengxian.resize(value=(cropped_img.width))
+        shuxian = shuxian.resize(value=(cropped_img.height),base='high')
+        shoesBg.paste_img(top_img=pp_jpg, value=(0, 0),base='cc')
+        shoesBg.paste_img(top_img=hengxian, value=(0, 80),base='cs')
+        shoesBg.paste_img(top_img=shuxian, value=((shoesBg.width/2- pp_png.width/2), 0),base='ec')
+        xiechang = self.get_text_value("鞋长")
+        banggao = self.get_text_value("帮高")
+        gen_gao = self.get_text_value("跟高")
+        xiezhang_kuan = self.get_text_value("鞋掌宽")
+        size_font = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 30)
+        
+        xiechang_bg = PictureProcessing("RGBA", (shoesBg.width, 500), (255, 255, 255,0))
+        xiechang_bg = xiechang_bg.get_text_image_advanced(
+                value=(0, 0),
+                font=size_font,
+                text=xiechang,
+                align="center",
+                fill=self.black_bg_color,
+                spacing=5,
+                return_mode="min_image",
+            )
+        shoesBg.paste_img(top_img=xiechang_bg, value=(0, 50),base='cs')
+        
+        
+        banggao_bg = PictureProcessing("RGBA", (shoesBg.width, 500), (255, 255, 255,0))
+        banggao_bg = banggao_bg.get_text_image_advanced(
+                value=(0, 0),
+                font=size_font,
+                text=banggao,
+                align="center",
+                fill=self.black_bg_color,
+                spacing=5,
+                return_mode="min_image",
+            )
+        shoesBg.paste_img(top_img=banggao_bg,value=((shoesBg.width/2- pp_png.width/2)-140, int(shoesBg.height*0.33)),base='en')
+        
+        gen_gao_bg = PictureProcessing("RGBA", (shoesBg.width, 500), (255, 255, 255,0))
+        gen_gao_bg = gen_gao_bg.get_text_image_advanced(
+                value=(0, 0),
+                font=size_font,
+                text=gen_gao,
+                align="center",
+                fill=self.black_bg_color,
+                spacing=5,
+                return_mode="min_image",
+            )
+        shoesBg.paste_img(top_img=gen_gao_bg,value=((shoesBg.width/2- pp_png.width/2)-140, int(shoesBg.height*0.33)),base='es')
+        
+        
+        xiezhang_kuan_bg = PictureProcessing("RGBA", (shoesBg.width, 500), (255, 255, 255,0))
+        xiezhang_kuan_bg = xiezhang_kuan_bg.get_text_image_advanced(
+                value=(0, 0),
+                font=size_font,
+                text=xiezhang_kuan,
+                align="center",
+                fill=self.black_bg_color,
+                spacing=5,
+                return_mode="min_image",
+            )
+        shoesBg.paste_img(top_img=xiezhang_kuan_bg,value=((shoesBg.width/2- pp_png.width/2), int(shoesBg.height*0.33)),base='nw')
+        
+        detailed_images.append(shoesBg)
+        text_bg5 = PictureProcessing("RGB", (top_bg.width, 100), (255, 255, 255))
+        detailed_images.append(text_bg5)
+        return self.pp_pic_subsection(PictureProcessing(im=self.add_pic(detailed_images)))
+    def deal_pic_7(self):
+        detailed_images = []
+        top_bg = PictureProcessing(r"{}\template_6.jpg".format(self.root))
+        attiribute = PictureProcessing("RGB", (top_bg.width, 300), (255, 255, 255))
+        x_position = top_bg.width*0.15
+        text_array = [
+            {"text":"品牌","position":(x_position,50),"default":"小苏",'base':'nw'},
+            {"text":"货号","position":(x_position,50),"default":"未填写",'base':'en'},
+            {"text":"鞋面","position":(x_position,120),"default":"未填写",'base':'nw'},
+            {"text":"内里","position":(x_position,120),"default":"未填写",'base':'en'},
+            {"text":"鞋垫","position":(x_position,190),"default":"未填写",'base':'nw'},
+            {"text":"鞋底","position":(x_position,190),"default":"未填写",'base':'en'},
+            ]
+        size_font = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 40)
+        for item in text_array:
+            text_flag = item["text"]
+            position = item["position"]
+            default = item["default"]
+            base = item["base"]
+            text_value = self.get_text_value(item["text"])
+            if not text_value:
+                text_value = default
+            gen_gao_bg = PictureProcessing("RGBA", (top_bg.width, 500), (255, 255, 255,0))
+            gen_gao_bg = gen_gao_bg.get_text_image_advanced(
+                    value=(0, 0),
+                    font=size_font,
+                    text=f"【{text_flag}】:{text_value}",
+                    align="center",
+                    fill=self.black_bg_color,
+                    spacing=5,
+                    return_mode="min_image",
+                )
+            attiribute.paste_img(top_img=gen_gao_bg, value=position,base=base)
+        bottom = PictureProcessing(r"{}\bottom.jpg".format(self.root))
+        detailed_images.append(attiribute)
+        detailed_images.append(bottom)
+        return self.pp_pic_subsection(PictureProcessing(im=self.add_pic(detailed_images)))
+    def deal_pic_8(self):
+        detailed_images = []
+        top_bg = PictureProcessing(r"{}\template_10.jpg".format(self.root))
+        detailed_images.append(top_bg)
+        bg_bottom = PictureProcessing("RGB", (top_bg.width, 100), (255, 255, 255))
+        detailed_images.append(bg_bottom)
+        # ==========添加颜色===================
         pp_list_1 = []
         font = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 25)
         goods_art_no_list = list(self.data.keys())
@@ -164,19 +531,19 @@ class DetailPicGet(DetailBase):
         for index, goods_art_no in enumerate(goods_art_no_list):
             pp_jpg = self.get_overlay_pic_from_dict(
                 goods_art_no=goods_art_no,
-                color_name="视",
-                bg_color=self.base_bg_color,
+                color_name="视",
+                bg_color=self.white_bg_color,
             )
             if pp_jpg is None:
                 continue
             pp_jpg = pp_jpg.resize(value=440)
             color_name = self.goods_no_value["货号资料"][index]["颜色名称"]
             all_color_name.append(color_name)
-            text_bg = PictureProcessing("RGB", (440, 200), (255, 255, 255))
+            text_bg = PictureProcessing("RGB", (440, 200), self.white_bg_color)
             text_bg = text_bg.get_text_image_advanced(
                 value=(220, 10),
                 font=font,
-                text="{}".format(color_name),
+                text="{}".format(color_name),
                 align="center",
                 anchor="mm",
                 spacing=5,
@@ -185,9 +552,9 @@ class DetailPicGet(DetailBase):
                 margins=(10, 5, 0, 0)
             )
             # text_bg.show()
-            _bg = PictureProcessing("RGB", (440, pp_jpg.height+text_bg.height), (255, 255, 255))
+            _bg = PictureProcessing("RGB", (440, pp_jpg.height + text_bg.height), self.white_bg_color)
             _bg = _bg.paste_img(top_img=pp_jpg)
-            _bg = _bg.paste_img(top_img=text_bg,value=(0,pp_jpg.height))
+            _bg = _bg.paste_img(top_img=text_bg, value=(0, pp_jpg.height))
             pp_list_1.append(_bg)
 
         rows = 2
@@ -199,249 +566,59 @@ class DetailPicGet(DetailBase):
             number_per_row=rows,
         )
         detailed_images.append(shoes_bg)
-
-
-        font_bg = PictureProcessing(r"{}\template_3_1_new.png".format(self.root))
-        font = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 30)
-        base_x = pp_bg.width - 229
-        base_y = 205
-
-        text_list = [
-            ("-{}".format("-".join(all_color_name)), (base_x, base_y)),
-            ("-{}".format(self.get_text_value("鞋面材质")), (base_x, base_y+70*1)),
-            ("-{}".format(self.get_text_value("内里材质")), (base_x, base_y+70*2)),
-            ("-{}".format(self.get_text_value("鞋底材质")), (base_x, base_y+70*3)),
-            ("-{}".format(self.get_text_value("鞋垫材质")), (base_x, base_y+70*4 )),
-            ("-{}".format(self.get_text_value("跟高")), (base_x, base_y+70*5)),
-            ("-{}".format(self.get_text_value("尺码")), (base_x, base_y+70*6)),
-        ]
-        for text_item in text_list:
-            position = text_item[1]
-            text_str = text_item[0]
-            xPos = position[0]
-            for char in reversed(text_str):
-                font_bg.add_text(
-                    mode="pixel",
-                    value=(xPos, position[1]),
-                    font=font,
-                    text=char,
-                    align="right",
-                    anchor="mm",
-                    spacing=10,
-                    fill=(30, 30, 30),
-                )
-                if not "\u4e00" <= char <= "\u9fff":
-                    xPos -= 20
-                else:
-                    xPos -= 35
-        # 其他图片
-        detailed_images.append(font_bg)
+        bg_bottom = PictureProcessing("RGB", (top_bg.width, 100), (255, 255, 255))
+        detailed_images.append(bg_bottom)
         return PictureProcessing(im=self.add_pic(detailed_images))
-
-    def deal_pic_4(self):
-        # =============设计理念================
-        detail_images = []
-        top_bg = PictureProcessing(r"{}\template_4.png".format(self.root))
-        detail_images.append(top_bg)
-
-        font_1 = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 40)
-        # 粘贴文字
-        text = self.get_text_value("设计理念")
-        if not text:
-            text = "引领全新裸足脚感,开启自信步履亲肤\n优质鞋面材质赋予全新舒适脚感\n多元场景穿搭,满足你的不同STYLE"
-        _, text_height = self.get_font_render_size(text, font_1)
-        text_bg = PictureProcessing(
-            "RGB",
-            (
-                top_bg.width,
-                text_height + 350,
-            ),
-            (236, 227, 212),
-        )
-        goods_art_no_list = list(self.data.keys())
-        # y = 430
-
-        x = top_bg.width / 2
-        text_bg = text_bg.add_text(
-            mode="pixel",
-            value=(x, int(text_bg.height / 2) - 60),
-            font=font_1,
-            text=text,
-            align="center",
-            anchor="mm",
-            spacing=15,
-            fill=(97, 97, 98),
-        )
-        detail_images.append(text_bg)
-
-        # ==========3个提示信息=========
-        title_font = ImageFont.truetype(r"resources\ttf\puhui\Heavy.ttf", 60)
-        sub_title_font = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 30)
-        desc_font = ImageFont.truetype(r"resources\ttf\puhui\Heavy.ttf", 35)
-        color_name_list = ["俯视", "内里", "侧视"]
-        # 添加分割线
-        detail_images.append(PictureProcessing("RGB", (top_bg.width, 100), (255, 255, 255)))
-
-        for index, color_name in enumerate(color_name_list):
-            # 添加分割线
-            detail_images.append(PictureProcessing("RGB", (top_bg.width, 20), (255, 255, 255)))
-
-            t_title = self.get_text_value("提示{}主标题".format(index + 1))
-            if t_title:
-                t_title_pp = PictureProcessing("RGB", (top_bg.width, 500), (255, 255, 255))
-                t_title_pp=t_title_pp.get_text_image_advanced(
-                    value=(int(top_bg.width / 2), 0),
-                    font=title_font,
-                    text=t_title,
-                    align="center",
-                    anchor="ma",
-                    spacing=10,
-                    fill=(55, 55, 55),
-                    return_mode="min_image_high",
-                    margins=(10, 10, 0, 0)
-                )
-                detail_images.append(t_title_pp)
-
-
-                t_sub_title = self.get_text_value("提示{}副标题".format(index + 1))
-                if t_sub_title:
-                    t_sub_title_pp = PictureProcessing("RGB", (top_bg.width, 500), (255, 255, 255))
-                    t_sub_title_pp = t_sub_title_pp.get_text_image_advanced(
-                        value=(int(top_bg.width / 2),0),
-                        font=sub_title_font,
-                        text=t_sub_title,
-                        align="center",
-                        anchor="ma",
-                        spacing=10,
-                        fill=(55, 55, 55),
-                        return_mode="min_image_high",
-                        margins=(10, 10, 0, 0)
-                    )
-                    detail_images.append(t_sub_title_pp)
-
-
-            # 添加图
-            pp_jpg = self.get_overlay_pic_from_dict(
-                goods_art_no=goods_art_no_list[0],
-                color_name=color_name,
-                bg_color=self.base_bg_color
-            )
-            t_desc = self.get_text_value("提示{}描述".format(index + 1))
-            if color_name == "俯视":
-                pp_jpg = pp_jpg.resize(value=1300)
-                pp_jpg = pp_jpg.paste_img_invert(
-                    top_img=PictureProcessing("RGB", (749, 1009 if pp_jpg.height>1009 else pp_jpg.height), (236, 227, 212)), base="ws",
-                    value=(-300, -50))
-                text_pos_value = (50, 50)
-                align = "left"
-                anchor = ""
-
-            if color_name == "内里":
-                pp_jpg = pp_jpg.resize(value=2000)
-                pp_jpg = pp_jpg.paste_img_invert(
-                    top_img=PictureProcessing("RGB", (749, pp_jpg.height + 150), (236, 227, 212)), base="wc",
-                    value=(-230, 0))
-                text_pos_value = (50, 50)
-                align = "left"
-                anchor = ""
-
-            if color_name == "侧视":
-                pp_jpg = pp_jpg.resize(value=1600)
-                pp_jpg = pp_jpg.paste_img_invert(
-                    top_img=PictureProcessing("RGB", (749, 1009 if pp_jpg.height>1009 else pp_jpg.height), (236, 227, 212)), base="se",
-                    value=(0, -30))
-                text_pos_value = (pp_jpg.width - 30, pp_jpg.height - 360)
-                align = "right"
-                anchor = "rs"
-
-            if t_desc:
-                pp_jpg = pp_jpg.add_text(
-                    mode="pixel",
-                    value=text_pos_value,
-                    font=desc_font,
-                    text=t_desc,
-                    align=align,
-                    anchor=anchor,
-                    spacing=10,
-                    fill=(102, 102, 102),
-                )
-            pp_jpg = pp_jpg.paste_img_invert(
-                top_img=PictureProcessing("RGB", (top_bg.width, pp_jpg.height,), (255, 255, 255), ), base="cc",
-                value=(0, 0))
-            detail_images.append(pp_jpg)
-            # 添加分割线
-            detail_images.append(PictureProcessing("RGB", (top_bg.width, 60), (255, 255, 255), ))
-
-        # 添加分割线
-        detail_images.append(PictureProcessing("RGB", (top_bg.width, 100), (255, 255, 255), ))
-        image = PictureProcessing(im=self.add_pic(detail_images))
-        return image
-
-    def deal_pic_5(self):
-        bg_color = (255, 255, 255)
+    def deal_pic_9(self):
         detailed_images = []
         goods_art_no_list = list(self.data.keys())
-        top_bg = PictureProcessing(
-            r"{}\template_5.png".format(
-                self.root
-            )
-        )
-
+        top_bg = PictureProcessing(r"{}\template_12.jpg".format(self.root))
         detailed_images.append(top_bg)
-        pp_list_1 = []
-        color_name_1 = ["俯视", "侧视", "内里", "后跟", "鞋底"]
-        color_name_2 = ["俯视", "鞋底"]
-
-        color_name_1 = ["俯视", "侧视", "鞋底"]
-        color_name_2 = ["俯视", "内里", "后跟"]
-        n = 0
-        pp_1_height = 100
-
-        for index, goods_art_no in enumerate(goods_art_no_list):
-            if index in [0, 2, 4, 6, 8]:
-                color_name = color_name_1
-            else:
-                color_name = color_name_2
-
-            for name in color_name:
-                pp_1 = self.get_overlay_pic_from_dict(
-                    goods_art_no=goods_art_no,
-                    color_name=name,
-                    bg_color=self.base_bg_color
-                )
-
-                if pp_1:
-                    n += 1
-                    if name != "后跟":
-                        pp_1 = pp_1.resize(value=int(top_bg.width / 1.4))
-                    else:
-                        pp_1 = pp_1.resize(value=int(top_bg.width / 3))
-
-                    if n == 1:
-                        pp_1_height = pp_1.height
-
-                    _height = pp_1.height if pp_1.height > pp_1_height else pp_1_height
-
-                    pp_1 = pp_1.paste_img_invert(base="cc",
-                                                 top_img=PictureProcessing("RGB",
-                                                                           (int(top_bg.width / 1.4), _height + 10,),
-                                                                           self.base_bg_color))
-
-                    pp_1 = pp_1.paste_img_invert(base="cc",
-                                                 top_img=PictureProcessing("RGB",
-                                                                           (top_bg.width, _height + 100,),
-                                                                           (255, 255, 255)))
-
-                    pp_list_1.append(pp_1)
-
-        if pp_list_1:
-            pp_list_1.append(PictureProcessing("RGB", (top_bg.width, 100), bg_color))
-            detailed_images.extend(pp_list_1)
-
-        # return PictureProcessing(im=self.add_pic(detailed_images))
-        return self.pp_pic_subsection(PictureProcessing(im=self.add_pic(detailed_images)))
-
-
+        # 鞋头
+        _bg = PictureProcessing("RGB", (top_bg.width, 600), self.white_bg_color)
+        radius_react = PictureProcessing("RGB", (top_bg.width*0.9, 600), (214, 190, 166))
+        radius_react = radius_react.radius(circular_pos=(1, 1, 1, 1), value=60)
+        _, pp_png = self.image_one_pic(return_orign=True,goods_art_no=goods_art_no_list[0],name="内里")
+        pp_png = pp_png.resize(value=round(top_bg.width*1.5))
+        pp_png = pp_png.rotate(doge=-120)
+        # _bg = _bg.paste_img(top_img=pp_png, value=(0, 0),base='cc')
+        radius_react.paste_img(top_img=pp_png, value=(0, 0),base='cc')
+        detailed_images.append(radius_react)
+        line = PictureProcessing("RGB", (top_bg.width, 100), self.white_bg_color)
+        detailed_images.append(line)
+        # 鞋跟
+        _bg = PictureProcessing("RGB", (top_bg.width, 600), self.white_bg_color)
+        radius_react = PictureProcessing("RGB", (top_bg.width*0.9, 600), (214, 190, 166))
+        radius_react = radius_react.radius(circular_pos=(1, 1, 1, 1), value=60)
+        _bg = _bg.paste_img(top_img=radius_react, value=(0, 0),base='cc')
+        detailed_images.append(_bg)
+        line = PictureProcessing("RGB", (top_bg.width, 100), self.white_bg_color)
+        detailed_images.append(line)
+        # 鞋底
+        _bg = PictureProcessing("RGB", (top_bg.width, 600), self.white_bg_color)
+        radius_react = PictureProcessing("RGB", (top_bg.width*0.9, 600), (214, 190, 166))
+        radius_react = radius_react.radius(circular_pos=(1, 1, 1, 1), value=60)
+        _bg = _bg.paste_img(top_img=radius_react, value=(0, 0),base='cc')
+        pp_jpg, pp_png = self.image_one_pic(return_orign=True,goods_art_no=goods_art_no_list[0],name="俯视")
+        pp_jpg = pp_jpg.resize(value=round(top_bg.width*0.8))
+        pp_png = pp_png.resize(value=round(top_bg.width*0.8))
+        top_bg = top_bg.to_overlay_pic_advance(top_img=pp_jpg, top_png_img=pp_png, base="cc",value=(0, 0))
+        detailed_images.append(_bg)
+        line = PictureProcessing("RGB", (top_bg.width, 100), self.white_bg_color)
+        detailed_images.append(line)
+        # 鞋底
+        return PictureProcessing(im=self.add_pic(detailed_images))
+    def deal_pic_10(self):
+        # template_15.jpg
+        # 模特展示
+        top_bg = PictureProcessing(r"{}\template_15.jpg".format(self.root))
+        detailed_images = []
+        detailed_images.append(top_bg)
+        return PictureProcessing(im=self.add_pic(detailed_images))
+    def deal_pic_11(self):
+        detailed_images = []
+        detailed_images.append(PictureProcessing(r"{}\template_22.jpg".format(self.root)))
+        return PictureProcessing(im=self.add_pic(detailed_images))
     def get_font_render_size(self, text, font, canvas_size=(2048, 2048)):
         canvas = Image.new('RGB', canvas_size)
         draw = ImageDraw.Draw(canvas)

+ 23 - 16
python/detail_template_test_xiaosushuoxie.json

@@ -63,21 +63,28 @@
         "主标题": "百搭休闲",
         "副标题": "简约百搭-轻盈软弹-舒适增高",
         "签名": "ST&SAT",
-        "设计理念": "经典凹出兼具动感同时带来轻盈\n步调轻软,松弛自在蔓延\n立体质感让朝气肆意绽放",
-        "帮面": "网布+合成革",
-        "鞋底": "橡胶底",
-        "内里": "网布",
-        "鞋垫": "合成革",
-        "鞋宽": "11.8CM",
-        "帮高": "5.7CM",
-        "跟高": "7.0CM",
-        "细节亮点主标题": "舒适鞋面",
-        "细节亮点副标题": "轻透网面享受每一步的清爽",
-        "艺-主标题": "鞋面弧形拼接",
-        "艺-副标题": "尽显不拘一格风尚",
-        "跟-主标题": "鞋底跟高7.0CM",
-        "跟-副标题": "迈步更轻松",
-        "底-主标题": "全底贴地 出行畅快",
-        "底-副标题": "凹凸纹理,轻松行走"
+        "设计理念1": "质感鞋面,细腻柔韧",
+        "设计理念2": "软糯内里彷佛脚踩云团",
+        "设计理念3": "气质优雅,轻盈百搭",
+        "鞋跟描述": "稳固舒适鞋跟",
+        "鞋头描述": "质感百搭鞋面",
+        "面料FAB1":"轻盈透气",
+        "面料FAB2": "(软弹不易累脚)",
+        "材质FAB1": "高弹柔韧 畅快出行",
+        "材质FAB2": "(橡胶材质,耐磨防滑)",
+        "材质FAB3": "耐磨纹理",
+        "材质FAB4": "软弹轻盈",
+        "材质FAB5": "方便舒适",
+        "跟高FAB":"+4CM跟高",
+        "适用场景FAB":"隐形增高不易累脚",
+        "鞋长":"鞋长24.5cm",
+        "货号": "AC51016112",
+        "帮高": "帮高10cm",
+        "跟高": "跟高4cm",
+        "鞋掌宽": "鞋掌宽\n8cm",
+        "鞋面":"猪剖层皮革+面层:合成革",
+        "内里": "织物",
+        "鞋垫": "鞋垫",
+        "鞋底": "鞋底"
     }
 }