detail_xiaosushuoxie5.py 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. """
  2. 步骤:
  3. 1、整理需要处理的款号图-输出款号图文件夹
  4. 2、整理所有相关的图片作为素材图
  5. 3、按要求进行拼接
  6. """
  7. import os
  8. import time
  9. from PIL import ImageFont
  10. from module.view_control.generate_goods_no_detail_pic.detail_generate_base import DetailBase
  11. from module.view_control.generate_goods_no_detail_pic.pic_deal import PictureProcessing
  12. from PIL import Image, ImageDraw
  13. import math
  14. class DetailPicGetXiaoSuShuoXie5(DetailBase):
  15. need_view = ["俯视", "侧视", "后跟", "鞋底", "内里"]
  16. root = r"{}\resources\detail_temp\xiaosushuoxie\5".format(os.getcwd())
  17. def __init__(self, goods_no, goods_no_value: dict, out_put_dir, windows=None, test=False, excel_data=None,assigned_page_list=None):
  18. super().__init__(goods_no, goods_no_value, out_put_dir, windows=windows, excel_data=excel_data,assigned_page_list=assigned_page_list)
  19. self.root = r"{}\resources\detail_temp\xiaosushuoxie\5".format(os.getcwd())
  20. print("run xiaosushuoxie-5 ")
  21. self.base_bg_color = (255, 255, 255)
  22. self.base_bg_color_2 = (244, 242, 243)
  23. self.deal_pic_func_list = [
  24. self.deal_pic_1,
  25. self.deal_pic_2,
  26. self.deal_pic_3,
  27. self.deal_pic_4,
  28. self.deal_pic_5,
  29. self.deal_pic_6,
  30. self.deal_pic_7,
  31. self.deal_pic_8,
  32. self.deal_pic_9,
  33. self.deal_pic_10,
  34. self.deal_pic_11,
  35. ]
  36. if test:
  37. # pp = self.generate_font_list_to_pic()
  38. # pp.im.save(r"C:\Users\gymmc\Desktop\细节图示例/字号.png")
  39. # for k, v in self.goods_no_value.items():
  40. # print(k, v)
  41. self.run_test()
  42. else:
  43. self.run_all()
  44. def run_test(self):
  45. detailed_images = []
  46. detailed_images.append(self.deal_pic_1())
  47. detailed_images.append(self.deal_pic_2())
  48. detailed_images.append(self.deal_pic_3())
  49. detailed_images.append(self.deal_pic_4())
  50. detailed_images.append(self.deal_pic_5())
  51. detailed_images.append(self.deal_pic_6())
  52. detailed_images.append(self.deal_pic_7())
  53. detailed_images.append(self.deal_pic_8())
  54. detailed_images.append(self.deal_pic_9())
  55. detailed_images.append(self.deal_pic_10())
  56. detailed_images.append(self.deal_pic_11())
  57. img = self.add_pic(detailed_images)
  58. img.save(r"{}/{}.jpg".format(self.out_put_dir,self.goods_no, format="JPEG"))
  59. # img.show()
  60. # 标题文字展示
  61. def deal_pic_1(self):
  62. pp_bg = PictureProcessing(r"{}\t (1).png".format(self.root))
  63. # -------粘贴文字-------
  64. font_1 = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 74) # 设计理念
  65. font_2 = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 44) # 描述主标题1
  66. font_3 = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 44) # 描述副标题1
  67. text_list = []
  68. text_list.append({"text": self.get_text_value("设计理念"),
  69. "font": font_1,
  70. "fill": (47, 44, 51),
  71. "spacing": 50,
  72. })
  73. # 主标题
  74. text_list.append({"text": self.get_text_value("标题"),
  75. "font": font_2,
  76. "fill": (124, 91, 24),
  77. })
  78. text_list.append({"text": self.get_text_value("副标题"),
  79. "font": font_3,
  80. "fill": (55, 55, 55),
  81. })
  82. text_image = self.add_text_list(text_list, spacing=15, base="en")
  83. if text_image:
  84. pp_bg = pp_bg.paste_img(
  85. top_img=text_image,
  86. base="ne",
  87. value=(133, 277))
  88. return pp_bg
  89. # 展示鞋头和后跟
  90. def deal_pic_2(self):
  91. pp_bg = PictureProcessing(r"{}\t (2).png".format(self.root))
  92. goods_art_no_list = list(self.data.keys())
  93. pp_jpg_1, pp_png_1 = self.image_one_pic(return_orign=True,
  94. goods_art_no=goods_art_no_list[0],
  95. name="内里",
  96. )
  97. pp_png_1: PictureProcessing
  98. pp_png_1 = pp_png_1.resize(value=1187)
  99. pp_png_1 = pp_png_1.rotate_advance(doge=90)
  100. pp_png_1 = pp_png_1.crop(bbox=(0, 0, pp_png_1.width, 473))
  101. pp_bg = pp_bg.paste_img(top_img=pp_png_1,
  102. value=(349 - pp_png_1.width / 2, 342),
  103. base="sw"
  104. )
  105. pp_jpg_2, pp_png_2 = self.image_one_pic(return_orign=True,
  106. goods_art_no=goods_art_no_list[0],
  107. name="后跟",
  108. )
  109. pp_png_2: PictureProcessing
  110. pp_png_2 = pp_png_2.resize(value=502)
  111. pp_png_2 = pp_png_2.crop(mode="min")
  112. pp_png_2 = pp_png_2.crop(bbox=(0, 0, pp_png_2.width, 473))
  113. pp_bg = pp_bg.paste_img(top_img=pp_png_2,
  114. value=(871 - pp_png_2.width / 2, 342),
  115. base="sw"
  116. )
  117. # 添加标题文字等
  118. # -------粘贴文字-------
  119. font_1 = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 42) # 特征标题
  120. font_2 = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 30) # 特征描述
  121. text_list = []
  122. # 鞋头特征
  123. text_list.append({"text": self.get_text_value("鞋头特征"),
  124. "font": font_1,
  125. "fill": (48, 43, 49),
  126. "spacing": 0,
  127. })
  128. # 主标题
  129. # 鞋头描述
  130. text_list.append({"text": self.get_text_value("鞋头描述"),
  131. "font": font_2,
  132. "fill": (164, 164, 164),
  133. })
  134. text_image = self.add_text_list(text_list, spacing=15, base="nc")
  135. if text_image:
  136. pp_bg = pp_bg.paste_img(
  137. top_img=text_image,
  138. base="nw",
  139. value=(349 - text_image.width / 2, 511))
  140. text_list = []
  141. # 后跟特征
  142. text_list.append({"text": self.get_text_value("后跟特征"),
  143. "font": font_1,
  144. "fill": (48, 43, 49),
  145. "spacing": 0,
  146. })
  147. # 后跟描述
  148. text_list.append({"text": self.get_text_value("后跟描述"),
  149. "font": font_2,
  150. "fill": (164, 164, 164),
  151. })
  152. text_image = self.add_text_list(text_list, spacing=15, base="nc")
  153. if text_image:
  154. pp_bg = pp_bg.paste_img(
  155. top_img=text_image,
  156. base="nw",
  157. value=(871 - text_image.width / 2, 511))
  158. return pp_bg
  159. # 展示鞋头放大图
  160. def deal_pic_3(self):
  161. pp_bg = PictureProcessing(r"{}\t (3).png".format(self.root))
  162. font_1 = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 70) # 设计理念
  163. font_2 = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 46) # 描述主标题1
  164. font_3 = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 44) # 描述主标题2
  165. text_list = []
  166. # 鞋头特征
  167. text_list.append({"text": self.get_text_value("设计理念2"),
  168. "font": font_1,
  169. "fill": (3, 3, 2),
  170. "spacing": 40,
  171. })
  172. # 主标题
  173. text_list.append({"text": self.get_text_value("提示2主标题"),
  174. "font": font_2,
  175. "fill": (124, 91, 24),
  176. })
  177. text_list.append({"text": self.get_text_value("提示2副标题"),
  178. "font": font_3,
  179. "fill": (26, 25, 23),
  180. })
  181. text_image = self.add_text_list(text_list, spacing=10, base="nw")
  182. if text_image:
  183. pp_bg = pp_bg.paste_img(
  184. top_img=text_image,
  185. base="nw",
  186. value=(140, 176))
  187. # 粘贴俯视图
  188. goods_art_no_list = list(self.data.keys())
  189. pp_jpg_1, pp_png_1 = self.image_one_pic(return_orign=True,
  190. goods_art_no=goods_art_no_list[0],
  191. name="俯视",
  192. )
  193. pp_png_1: PictureProcessing
  194. pp_png_1 = pp_png_1.resize(value=1933)
  195. pp_png_1 = pp_png_1.crop(mode="min")
  196. pp_bg = pp_bg.paste_img(top_img=pp_png_1,
  197. value=(202, 86),
  198. base="sw"
  199. )
  200. return pp_bg
  201. # 展示后跟放大图
  202. def deal_pic_4(self):
  203. pp_bg = PictureProcessing(r"{}\t (4).png".format(self.root))
  204. h = 176
  205. # ===========粘贴文字============
  206. font_2 = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 46) # 描述主标题1
  207. font_3 = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 44) # 描述主标题2
  208. text_list = []
  209. # 鞋头特征
  210. # 主标题
  211. text_list.append({"text": self.get_text_value("提示3主标题"),
  212. "font": font_2,
  213. "fill": (124, 91, 24),
  214. })
  215. text_list.append({"text": self.get_text_value("提示3副标题"),
  216. "font": font_3,
  217. "fill": (26, 25, 23),
  218. })
  219. text_image = self.add_text_list(text_list, spacing=10, base="ne")
  220. if text_image:
  221. pp_bg = pp_bg.paste_img(
  222. top_img=text_image,
  223. base="ne",
  224. value=(140, h))
  225. # 粘贴侧视图
  226. goods_art_no_list = list(self.data.keys())
  227. pp_jpg, pp_png = self.image_one_pic(return_orign=True,
  228. goods_art_no=goods_art_no_list[0],
  229. name="侧视",
  230. )
  231. pp_jpg = pp_jpg.resize(value=2000)
  232. pp_png = pp_png.resize(value=2000)
  233. if text_image:
  234. h = h + text_image.height
  235. else:
  236. h = h
  237. pp_bg = pp_bg.to_overlay_pic_advance(mode="pixel", top_img=pp_jpg, base="en", value=(100, h),
  238. top_png_img=pp_png)
  239. # 总高
  240. h = h + pp_jpg.height + 50
  241. if h < pp_bg.height:
  242. # 剪裁
  243. pp_bg = pp_bg.crop(bbox=(0, 0, 1200, h))
  244. return pp_bg
  245. # 展示后跟细节卡片
  246. def deal_pic_5(self):
  247. pp_bg = PictureProcessing(r"{}\t (5).png".format(self.root))
  248. # 粘贴侧视图
  249. goods_art_no_list = list(self.data.keys())
  250. pp_jpg_1, pp_png_1 = self.image_one_pic(return_orign=True,
  251. goods_art_no=goods_art_no_list[0],
  252. name="侧视",
  253. )
  254. pp_png_1: PictureProcessing
  255. pp_png_1 = pp_png_1.resize(value=1621)
  256. pp_png_1 = pp_png_1.rotate_advance(doge=45)
  257. pp_png_1 = pp_png_1.transpose()
  258. pp_png_1 = pp_png_1.crop(mode="min")
  259. shoe_bg = PictureProcessing("RGB", (448, 464), self.base_bg_color)
  260. shoe_bg = shoe_bg.paste_img(top_img=pp_png_1,
  261. value=(-80, 200),
  262. base="wc"
  263. )
  264. shoe_bg = shoe_bg.radius(circular_pos=(0, 0, 1, 0), value=30)
  265. pp_bg = pp_bg.paste_img(top_img=shoe_bg,
  266. value=(613, 174),
  267. base="nw")
  268. # 添加文字
  269. font_1 = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 40) # 设计理念
  270. font_2 = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 30) # 描述主标题1
  271. text_list = []
  272. text_list.append({"text": self.get_text_value("提示4主标题"),
  273. "font": font_1,
  274. "fill": (10, 7, 6),
  275. })
  276. text_list.append({"text": self.get_text_value("提示4副标题"),
  277. "font": font_2,
  278. "fill": (72, 65, 59),
  279. })
  280. text_image = self.add_text_list(text_list, spacing=38, base="nw")
  281. if text_image:
  282. pp_bg = pp_bg.paste_img(
  283. top_img=text_image,
  284. base="nw",
  285. value=(154, 210))
  286. return pp_bg
  287. # "心动"设计亮点,展示旋转的侧视图
  288. def deal_pic_6(self):
  289. detailed_images = []
  290. pp_bg = PictureProcessing(r"{}\t (6).png".format(self.root))
  291. # 粘贴侧视图
  292. goods_art_no_list = list(self.data.keys())
  293. pp_jpg_1, pp_png_1 = self.image_one_pic(return_orign=True,
  294. goods_art_no=goods_art_no_list[0],
  295. name="侧视",
  296. )
  297. pp_png_1: PictureProcessing
  298. pp_png_1 = pp_png_1.resize(value=2050)
  299. pp_png_1 = pp_png_1.transpose()
  300. pp_png_1 = pp_png_1.rotate_advance(doge=20)
  301. pp_png_1 = pp_png_1.crop(mode="min")
  302. pp_bg = pp_bg.paste_img(top_img=pp_png_1,
  303. value=(-200, 200),
  304. base="ws"
  305. )
  306. # ========添加文字==================
  307. font_1 = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 70) # 设计理念
  308. text = self.get_text_value("设计理念3")
  309. pp_bg = pp_bg.get_text_image_advanced(
  310. value=(pp_bg.width - 127, pp_bg.height - 43),
  311. font=font_1,
  312. text=text,
  313. anchor="rs",
  314. align="right",
  315. spacing=5,
  316. fill=(109, 107, 109),
  317. return_mode="image",
  318. )
  319. return pp_bg
  320. # 产品展示,展示大图各个细节
  321. def deal_pic_7(self):
  322. detailed_images = []
  323. detailed_images.append(PictureProcessing(r"{}\t (7).png".format(self.root)))
  324. goods_art_no_list = list(self.data.keys())
  325. goods_art_no = goods_art_no_list[0]
  326. # ======展示组合图============
  327. pp_1 = self.get_overlay_pic_from_dict(
  328. goods_art_no=goods_art_no,
  329. color_name="组合",
  330. bg_color=self.base_bg_color_2
  331. )
  332. if pp_1:
  333. pp_1 = pp_1.resize(value=1200)
  334. pp_1 = pp_1.paste_img_invert(
  335. top_img=PictureProcessing("RGB", (1200, pp_1.height + 300), self.base_bg_color_2),
  336. base="cc", )
  337. detailed_images.append(pp_1)
  338. # ======展示鞋面===============
  339. detailed_images.append(PictureProcessing(r"{}\t (9).png".format(self.root)))
  340. pp_2 = self.get_overlay_pic_from_dict(
  341. goods_art_no=goods_art_no,
  342. color_name="俯视",
  343. bg_color=self.base_bg_color_2
  344. )
  345. pp_2: PictureProcessing
  346. pp_2 = pp_2.resize(value=1519)
  347. pp_2 = pp_2.paste_img_invert(top_img=PictureProcessing("RGB", (1200, pp_2.height + 50), self.base_bg_color_2),
  348. base="ws", value=(171, 0))
  349. detailed_images.append(pp_2)
  350. # =======展示后跟=========
  351. detailed_images.append(PictureProcessing(r"{}\t (10).png".format(self.root)))
  352. pp_3 = self.get_overlay_pic_from_dict(
  353. goods_art_no=goods_art_no,
  354. color_name="侧视",
  355. bg_color=self.base_bg_color_2
  356. )
  357. pp_3: PictureProcessing
  358. pp_3 = pp_3.resize(value=1881)
  359. pp_3 = pp_3.paste_img_invert(top_img=PictureProcessing("RGB", (1200, pp_3.height + 200), self.base_bg_color_2),
  360. base="ec", value=(171, 0))
  361. detailed_images.append(pp_3)
  362. # =========展示鞋底============
  363. detailed_images.append(PictureProcessing(r"{}\t (11).png".format(self.root)))
  364. pp_jpg_4, pp_png_4 = self.image_one_pic(return_orign=True,
  365. goods_art_no=goods_art_no,
  366. name="鞋底",
  367. )
  368. pp_png_4: PictureProcessing
  369. pp_png_4 = pp_png_4.resize(value=2380)
  370. pp_png_4 = pp_png_4.rotate_advance(doge=45)
  371. pp_png_4 = pp_png_4.paste_img_invert(
  372. top_img=PictureProcessing("RGB", (1200, pp_png_4.height + 200), self.base_bg_color_2),
  373. base="ws", value=(269, 81))
  374. detailed_images.append(pp_png_4)
  375. return PictureProcessing(im=self.add_pic(detailed_images))
  376. # 功能展示与卖点
  377. def deal_pic_8(self):
  378. detailed_images = []
  379. detailed_images.append(PictureProcessing(r"{}\t (12).png".format(self.root)))
  380. goods_art_no_list = list(self.data.keys())
  381. goods_art_no = goods_art_no_list[0]
  382. color_name_list = ["侧视", "鞋底", "俯视"]
  383. font_1 = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 42) # 卖点标题1
  384. font_2 = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 32) # 卖点标题2
  385. font_3 = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 26) # 卖点描述1
  386. # =====卖点1,展示后跟========
  387. for color_name in color_name_list:
  388. bg = PictureProcessing(r"{}\t (13).png".format(self.root))
  389. pp_jpg, pp_png = self.image_one_pic(return_orign=True,
  390. goods_art_no=goods_art_no,
  391. name=color_name,
  392. )
  393. temp_bg = PictureProcessing("RGB", (536, 424), (214, 214, 214))
  394. if color_name == "侧视":
  395. pp_png = pp_png.resize(value=990)
  396. temp_bg = temp_bg.paste_img(top_img=pp_png, base="es")
  397. shoe_paste_base = "wc"
  398. text_1, text_2 = self.get_text_value("卖点1标题", subsection_len=2)
  399. text_3 = self.get_text_value("卖点1介绍")
  400. text_paste_base = "ec"
  401. text_paste_value = (312, 0)
  402. if color_name == "鞋底":
  403. pp_png = pp_png.resize(value=1000)
  404. temp_bg = temp_bg.paste_img(top_img=pp_png, base="wc", value=(0, 0))
  405. shoe_paste_base = "ec"
  406. text_1, text_2 = self.get_text_value("卖点2标题", subsection_len=2)
  407. text_3 = self.get_text_value("卖点2介绍")
  408. text_paste_base = "wc"
  409. text_paste_value = (312, 0)
  410. if color_name == "俯视":
  411. pp_png = pp_png.resize(value=1418)
  412. temp_bg = temp_bg.paste_img(top_img=pp_png, base="cc")
  413. shoe_paste_base = "wc"
  414. text_1, text_2 = self.get_text_value("卖点3标题", subsection_len=2)
  415. text_3 = self.get_text_value("卖点3介绍")
  416. text_paste_base = "ec"
  417. text_paste_value = (312, 0)
  418. # 添加圆角
  419. temp_bg = temp_bg.radius(circular_pos=(1, 1, 1, 1), value=50)
  420. # 粘贴到背景上
  421. temp_bg = temp_bg.paste_img_invert(top_img=bg, base=shoe_paste_base, value=(99, 0))
  422. text_list = []
  423. # 卖点主标题
  424. text_list.append({"text": text_1,
  425. "font": font_1,
  426. "fill": (2, 2, 2),
  427. "spacing": 0,
  428. })
  429. text_list.append({"text": text_2,
  430. "font": font_2,
  431. "fill": (43, 43, 43),
  432. "spacing": 10,
  433. })
  434. # 主标题
  435. text_list.append({"text": text_3,
  436. "font": font_3,
  437. "fill": (165, 165, 165),
  438. })
  439. text_image = self.add_text_list(text_list, spacing=15, base="nc")
  440. if text_image:
  441. temp_bg = temp_bg.paste_img(
  442. top_img=text_image,
  443. base=text_paste_base,
  444. value=(text_paste_value[0] - text_image.width / 2, text_paste_value[1]))
  445. detailed_images.append(temp_bg)
  446. return PictureProcessing(im=self.add_pic(detailed_images))
  447. # 添加尺码表
  448. def deal_pic_9(self):
  449. image_path = r"{}\t (16).png".format(self.root)
  450. return PictureProcessing(image_path)
  451. # 角度展示
  452. def deal_pic_10(self):
  453. detailed_images = []
  454. # 角度展示标题
  455. detailed_images.append(PictureProcessing(r"{}\t (17).png".format(self.root)))
  456. # 添加颜色名称字体
  457. font_color = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 30)
  458. for goods_art_no_dict in self.goods_no_value["货号资料"]:
  459. color_name = goods_art_no_dict["颜色名称"]
  460. goods_art_no = goods_art_no_dict["货号"]
  461. # ====颜色主图
  462. pp_1 = self.get_overlay_pic_from_dict(
  463. goods_art_no=goods_art_no,
  464. color_name="俯视",
  465. bg_color=(255, 255, 255)
  466. )
  467. pp_1: PictureProcessing
  468. pp_1 = pp_1.resize(value=865)
  469. pp_1 = pp_1.paste_img_invert(top_img=PictureProcessing("RGB", (1152, pp_1.height + 100), (255, 255, 255)),
  470. base="sc"
  471. )
  472. # 粘贴颜色名称
  473. pp_1 = pp_1.get_text_image_advanced(
  474. value=(90, 50),
  475. font=font_color,
  476. text=color_name,
  477. spacing=1,
  478. return_mode="image",
  479. )
  480. pp_1 = pp_1.paste_img_invert(top_img=PictureProcessing("RGB", (1200, pp_1.height), (243, 243, 243)),
  481. base="cc"
  482. )
  483. detailed_images.append(pp_1)
  484. # 添加处理各个角度
  485. view_name_list = ["内里", "鞋底", "后跟", "侧视"]
  486. color_pic_list = []
  487. for view_name in view_name_list:
  488. _, pp_png = self.image_one_pic(return_orign=True,
  489. goods_art_no=goods_art_no,
  490. name=view_name,
  491. )
  492. temp_bg = PictureProcessing("RGB", (546, 338), (243, 243, 243))
  493. # if view_name == "内里":
  494. # pp_png = pp_png.resize(base_by_box=(temp_bg.width * 0.9, temp_bg.height * 0.9))
  495. # if view_name == "鞋底":
  496. # pp_png = pp_png.resize(base_by_box=(temp_bg.width * 0.9, temp_bg.height * 0.9))
  497. # if view_name == "后跟":
  498. # pp_png = pp_png.resize(base_by_box=(temp_bg.width * 0.9, temp_bg.height * 0.9))
  499. # if view_name == "侧视":
  500. # pp_png = pp_png.resize(base_by_box=(temp_bg.width * 0.9, temp_bg.height * 0.9))
  501. pp_png = pp_png.resize(base_by_box=(temp_bg.width * 0.9, temp_bg.height * 0.9))
  502. temp_bg = temp_bg.paste_img(top_img=pp_png, base="cc")
  503. temp_bg = temp_bg.radius(value=30)
  504. color_pic_list.append(temp_bg)
  505. # 颜色列表进行等分展示
  506. all_color_pp = PictureProcessing().horizontal_distribution(color_pic_list, bg_width=1114, line_spacing=10,
  507. number_per_row=2)
  508. all_color_pp = all_color_pp.paste_img_invert(
  509. top_img=PictureProcessing("RGB", (1152, all_color_pp.height + 100), (255, 255, 255)), base="cc")
  510. all_color_pp = all_color_pp.paste_img_invert(
  511. top_img=PictureProcessing("RGB", (1200, all_color_pp.height), (243, 243, 243)), base="cc")
  512. detailed_images.append(all_color_pp)
  513. # 添加底部圆弧分割线
  514. b_bg = PictureProcessing("RGB", (1152, 30), (255, 255, 255))
  515. b_bg = b_bg.radius(circular_pos=(0, 0, 1, 1), value=30)
  516. b_bg = b_bg.paste_img_invert(top_img=PictureProcessing("RGB", (1200, b_bg.height + 50), (243, 243, 243)),
  517. base="nc")
  518. detailed_images.append(b_bg)
  519. return PictureProcessing(im=self.add_pic(detailed_images))
  520. # 添加注意事项
  521. def deal_pic_11(self):
  522. image_path = r"{}\t (21).png".format(self.root)
  523. return PictureProcessing(image_path)