detail_huilima5.py 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. """
  2. 步骤:
  3. 1、整理需要处理的款号图-输出款号图文件夹
  4. 2、整理所有相关的图片作为素材图
  5. 3、按要求进行拼接
  6. """
  7. import os
  8. from PIL import ImageFont
  9. import sys
  10. import settings
  11. # from module.view_control.generate_goods_no_detail_pic.detail_generate_base import DetailBase
  12. # from module.view_control.generate_goods_no_detail_pic.pic_deal import PictureProcessing
  13. is_test_plugins = False
  14. try:
  15. is_test_plugins = settings.is_test_plugins
  16. except:
  17. is_test_plugins = False
  18. if is_test_plugins:
  19. from custom_plugins.plugins_mode.detail_generate_base import DetailBase
  20. from custom_plugins.plugins_mode.pic_deal import PictureProcessing
  21. else:
  22. from plugins_mode.detail_generate_base import DetailBase
  23. from plugins_mode.pic_deal import PictureProcessing
  24. plugins_name = "详情模板"
  25. company_name_list = ["全部"]
  26. template_name = "huilima-5"
  27. # 乐福鞋 详情页
  28. class DetailPicGet(DetailBase):
  29. need_view = ["俯视", "侧视", "后跟", "鞋底", "内里"]
  30. root = r"{}\resources\detail_temp\huilima\5".format(os.getcwd())
  31. def __init__(
  32. self,
  33. goods_no,
  34. goods_no_value: dict,
  35. out_put_dir,
  36. windows=None,
  37. test=False,
  38. excel_data=None,
  39. assigned_page_list=None,
  40. output_queue=None,
  41. **kwargs
  42. ):
  43. super().__init__(
  44. goods_no,
  45. goods_no_value,
  46. out_put_dir,
  47. windows=windows,
  48. excel_data=excel_data,
  49. assigned_page_list=assigned_page_list,
  50. output_queue=output_queue,
  51. )
  52. self.template_name = template_name
  53. self.root = r"{}\resources\detail_temp\huilima\5".format(os.getcwd())
  54. print("run huilima-1 ")
  55. self.base_bg_color = (255, 255, 255)
  56. self.deal_pic_func_list = [
  57. self.deal_pic_1,
  58. self.deal_pic_2,
  59. self.deal_pic_3,
  60. self.deal_pic_4,
  61. self.deal_pic_5,
  62. self.deal_pic_6,
  63. self.deal_pic_6_2,
  64. self.deal_pic_6_3,
  65. self.deal_pic_7,
  66. self.deal_pic_8,
  67. ]
  68. if test:
  69. self.run_test()
  70. else:
  71. self.run_all()
  72. def run_test(self):
  73. detailed_images = []
  74. detailed_images.append(self.deal_pic_1())
  75. detailed_images.append(self.deal_pic_2())
  76. detailed_images.append(self.deal_pic_3())
  77. detailed_images.append(self.deal_pic_4())
  78. detailed_images.append(self.deal_pic_5())
  79. detailed_images.append(self.deal_pic_6())
  80. detailed_images.append(self.deal_pic_7())
  81. detailed_images.append(self.deal_pic_8())
  82. img = self.add_pic(detailed_images)
  83. if img:
  84. self.create_folder(r"{}/{}".format(self.out_put_dir, template_name))
  85. img.save(
  86. r"{}/{}/{}.jpg".format(
  87. self.out_put_dir, template_name, self.goods_no, format="JPEG"
  88. )
  89. )
  90. img.show()
  91. #
  92. def deal_pic_1(self):
  93. detailed_images = []
  94. pp_bg_1 = PictureProcessing(r"{}\1.jpg".format(self.root), 1600)
  95. font_main = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 160)
  96. font_sub = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 50)
  97. main_text = self.get_text_value("标题")
  98. sub_text = self.get_text_value("副标题")
  99. if not main_text:
  100. main_text = "复古勃肯"
  101. _pp = PictureProcessing().get_text_image_advanced(
  102. font=font_main,
  103. text=main_text,
  104. fill=(0, 0, 0),
  105. spacing=20,
  106. return_mode="min_image",
  107. )
  108. if not sub_text:
  109. sub_text = "百搭|舒适|柔软|耐穿|复古|高级"
  110. _pp_sub = PictureProcessing().get_text_image_advanced(
  111. font=font_sub,
  112. text=sub_text,
  113. fill=(0, 0, 0),
  114. return_mode="min_image",
  115. )
  116. pp_bg_1 = pp_bg_1.paste_img(top_img=_pp, value=(0, 232), base="cs")
  117. pp_bg_1 = pp_bg_1.paste_img(top_img=_pp_sub, value=(0, 446), base="cs")
  118. goods_art_no_list = list(self.data.keys())
  119. pp_jpg_1_list = []
  120. pp_png_1_list = []
  121. pp_jpg, pp_png = self.image_one_pic(
  122. return_orign=True,
  123. goods_art_no=goods_art_no_list[0],
  124. name="俯视",
  125. )
  126. pp_jpg_1_list.append(pp_jpg)
  127. pp_jpg_1_list.append(pp_jpg)
  128. pp_png_1_list.append(pp_png)
  129. pp_png_1_list.append(pp_png)
  130. x, y = 0, 0
  131. pp_bg_jpg = PictureProcessing("RGB", (1600, 1600), (255, 255, 255))
  132. _resize_value = (
  133. pp_bg_1.width if len(pp_jpg_1_list) == 1 else pp_bg_1.width - 300
  134. )
  135. for index, pp_jpg in enumerate(pp_jpg_1_list):
  136. pp_jpg = pp_jpg.resize(value=_resize_value + 100 * index)
  137. pp_bg_jpg = pp_bg_jpg.to_overlay_pic_advance(top_img=pp_jpg, value=(x, y))
  138. x += 180
  139. y += 60
  140. x, y = 0, 0
  141. pp_bg_png = PictureProcessing("RGBA", (1600, 1600), (255, 255, 255, 0))
  142. for index, pp_png in enumerate(pp_png_1_list):
  143. pp_png = pp_png.resize(value=_resize_value + 100 * index)
  144. pp_bg_png = pp_bg_png.paste_img(top_img=pp_png, value=(x, y))
  145. x += 180
  146. y += 60
  147. min_bbox = pp_bg_png.getbbox()
  148. min_bbox = PictureProcessing().expand_bbox(min_bbox)
  149. pp_bg_jpg = pp_bg_jpg.crop(bbox=min_bbox)
  150. pp_bg_png = pp_bg_png.crop(bbox=min_bbox)
  151. pp_bg_1 = pp_bg_1.to_overlay_pic_advance(
  152. top_img=pp_bg_jpg, top_png_img=pp_bg_png, base="cc"
  153. )
  154. detailed_images.append(pp_bg_1)
  155. # detailed_images.append(pp_bg_2)
  156. return PictureProcessing(im=self.add_pic(detailed_images))
  157. # 展示基础信息
  158. def deal_pic_2(self):
  159. detailed_images = []
  160. pp_bg_2 = PictureProcessing(r"{}\2.jpg".format(self.root))
  161. font_1 = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 130)
  162. font_desc = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 48)
  163. text = self.get_text_value("设计理念-标题")
  164. text_desc = self.get_text_value("设计理念")
  165. if not text:
  166. text = "让勃肯鞋陪你CITY一下"
  167. if not text_desc:
  168. text_desc = "以独特得复古风格,让你在繁华都市中独树一帜\n独特得软木颗粒中底设计,提供出色得缓效果\n轻松打造出慵懒而不失格调的复古风\n后跟部分可灵活调整,让你在不同场合都能找到\n最舒适得穿着方式"
  169. _pp = PictureProcessing().get_text_image_advanced(
  170. font=font_1,
  171. text=text,
  172. fill=(0, 0, 0),
  173. return_mode="min_image",
  174. )
  175. _pp_desc = PictureProcessing().get_text_image_advanced(
  176. font=font_desc,
  177. text=text_desc,
  178. fill=(0, 0, 0),
  179. spacing=30,
  180. align="center",
  181. return_mode="min_image",
  182. )
  183. pp_bg_2 = pp_bg_2.paste_img(top_img=_pp, value=(0, 212), base="nc")
  184. pp_bg_2 = pp_bg_2.paste_img(top_img=_pp_desc, value=(0, 533), base="nc")
  185. detailed_images.append(pp_bg_2)
  186. return PictureProcessing(im=self.add_pic(detailed_images))
  187. # 颜色展示
  188. def deal_pic_3(self):
  189. detailed_images = []
  190. pp_bg = PictureProcessing(r"{}\3.jpg".format(self.root))
  191. font_color = ImageFont.truetype(
  192. r"resources\ttf\puhui\Medium.ttf", 34
  193. ) # 颜色名称
  194. color_pic_list_1 = []
  195. for goods_art_no_dict in self.goods_no_value["货号资料"]:
  196. color_name = goods_art_no_dict["颜色名称"]
  197. goods_art_no = goods_art_no_dict["货号"]
  198. pp_jpg = self.get_overlay_pic_from_dict(
  199. goods_art_no=goods_art_no,
  200. color_name="侧视",
  201. bg_color=self.base_bg_color,
  202. )
  203. pp_jpg = pp_jpg.resize(value=pp_bg.width / 2)
  204. pp_jpg = pp_jpg.paste_img_invert(
  205. top_img=PictureProcessing(
  206. "RGBA", (pp_jpg.width, pp_jpg.height + 70), (255, 255, 255, 0)
  207. ),
  208. base="nw",
  209. )
  210. text_image = PictureProcessing().get_text_image_advanced(
  211. font=font_color,
  212. text="{}".format(color_name),
  213. fill=(0, 0, 0),
  214. return_mode="min_image",
  215. )
  216. pp_jpg = pp_jpg.paste_img(top_img=text_image, base="sc", value=(0, 10))
  217. color_pic_list_1.append(pp_jpg)
  218. # 颜色列表进行等分展示
  219. all_color_pp = PictureProcessing().horizontal_distribution(
  220. color_pic_list_1,
  221. bg_width=pp_bg.width - 100,
  222. line_spacing=10,
  223. number_per_row=2,
  224. )
  225. pp_bg.paste_img(top_img=all_color_pp, base="cc", value=(0, -100))
  226. font_category = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 50)
  227. text_xiemian = self.get_text_value("鞋面")
  228. if not text_xiemian:
  229. text_xiemian = self.get_text_value("商品面料")
  230. text_xiedi = self.get_text_value("鞋底")
  231. if not text_xiedi:
  232. text_xiedi = self.get_text_value("商品鞋底")
  233. text_neili = self.get_text_value("内里")
  234. if not text_neili:
  235. text_neili = self.get_text_value("商品内里")
  236. text_xiedian = self.get_text_value("鞋垫")
  237. if text_xiemian:
  238. pp_text_xiemian = PictureProcessing().get_text_image_advanced(
  239. font=font_category,
  240. text=text_xiemian,
  241. fill=(0, 0, 0),
  242. return_mode="min_image",
  243. )
  244. pp_bg = pp_bg.paste_img(
  245. top_img=pp_text_xiemian, value=(416, 960), base="nw"
  246. )
  247. if text_xiedian:
  248. pp_text_xiedian = PictureProcessing().get_text_image_advanced(
  249. font=font_category,
  250. text=text_xiedian,
  251. fill=(0, 0, 0),
  252. return_mode="min_image",
  253. )
  254. pp_bg = pp_bg.paste_img(
  255. top_img=pp_text_xiedian, value=(416, 1144), base="nw"
  256. )
  257. if text_xiedi:
  258. pp_text_xiedi = PictureProcessing().get_text_image_advanced(
  259. font=font_category,
  260. text=text_xiedi,
  261. fill=(0, 0, 0),
  262. return_mode="min_image",
  263. )
  264. pp_bg = pp_bg.paste_img(
  265. top_img=pp_text_xiedi, value=(1157, 1144), base="nw"
  266. )
  267. if text_neili:
  268. pp_text_neili = PictureProcessing().get_text_image_advanced(
  269. font=font_category,
  270. text=text_neili,
  271. fill=(0, 0, 0),
  272. return_mode="min_image",
  273. )
  274. pp_bg = pp_bg.paste_img(top_img=pp_text_neili, value=(1157, 960), base="nw")
  275. detailed_images.append(pp_bg)
  276. return PictureProcessing(im=self.add_pic(detailed_images))
  277. # 展示细节图
  278. def deal_pic_4(self):
  279. detailed_images = []
  280. bg_image = PictureProcessing(r"{}\4.jpg".format(self.root))
  281. text_fill = (255, 255, 255)
  282. font_title = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 150)
  283. font_sub = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 50)
  284. text_title = self.get_text_value("细节标题-1")
  285. if not text_title:
  286. text_title = "可调节饰扣"
  287. text_sub_title = self.get_text_value("细节副标题-1")
  288. if not text_sub_title:
  289. text_sub_title = "三孔调节饰扣,搭配不同脚型"
  290. pp_text_title = PictureProcessing().get_text_image_advanced(
  291. font=font_title,
  292. text=text_title,
  293. fill=text_fill,
  294. return_mode="min_image",
  295. )
  296. pp_text_sub_title = PictureProcessing().get_text_image_advanced(
  297. font=font_sub,
  298. text=text_sub_title,
  299. fill=text_fill,
  300. return_mode="min_image",
  301. )
  302. bg_image.paste_img(top_img=pp_text_title, base="en", value=(108, 258))
  303. bg_image.paste_img(top_img=pp_text_sub_title, base="en", value=(108, 578))
  304. goods_art_no_list = list(self.data.keys())
  305. _, pp_png = self.image_one_pic(
  306. return_orign=True,
  307. goods_art_no=goods_art_no_list[0],
  308. name="俯视",
  309. )
  310. pp_png = pp_png.resize(value=bg_image.width * 2)
  311. bg_image.paste_img(top_img=pp_png, base="cs", value=(-pp_png.width / 4, -200))
  312. detailed_images.append(bg_image)
  313. return PictureProcessing(im=self.add_pic(detailed_images))
  314. # 场景图--产品展示
  315. def deal_pic_5(self):
  316. detailed_images = []
  317. bg_image = PictureProcessing(r"{}\5.jpg".format(self.root))
  318. text_fill = (255, 255, 255)
  319. font_title = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 150)
  320. font_sub = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 50)
  321. text_title = self.get_text_value("细节标题-2")
  322. if not text_title:
  323. text_title = "细腻反绒鞋面"
  324. text_sub_title = self.get_text_value("细节副标题-2")
  325. if not text_sub_title:
  326. text_sub_title = "鞋面采用触感舒适得牛反绒\n彰显复古慵懒属性\n轻松驾驭不同穿搭"
  327. pp_text_title = PictureProcessing().get_text_image_advanced(
  328. font=font_title,
  329. text=text_title,
  330. fill=text_fill,
  331. return_mode="min_image",
  332. )
  333. pp_text_sub_title = PictureProcessing().get_text_image_advanced(
  334. font=font_sub,
  335. text=text_sub_title,
  336. fill=text_fill,
  337. return_mode="min_image",
  338. )
  339. bg_image.paste_img(top_img=pp_text_title, base="nw", value=(115, 369))
  340. bg_image.paste_img(top_img=pp_text_sub_title, base="nw", value=(115, 686))
  341. goods_art_no_list = list(self.data.keys())
  342. _, pp_png = self.image_one_pic(
  343. return_orign=True,
  344. goods_art_no=goods_art_no_list[0],
  345. name="俯视",
  346. )
  347. pp_png = pp_png.resize(value=bg_image.width * 2)
  348. bg_image.paste_img(top_img=pp_png, base="cs", value=(pp_png.width / 4, 0))
  349. detailed_images.append(bg_image)
  350. return PictureProcessing(im=self.add_pic(detailed_images))
  351. # 场景图--产品展示
  352. def deal_pic_6(self):
  353. detailed_images = []
  354. bg_image = PictureProcessing(r"{}\6.jpg".format(self.root))
  355. text_fill = (255, 255, 255)
  356. font_title = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 150)
  357. font_sub = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 50)
  358. text_title = self.get_text_value("细节标题-3")
  359. if not text_title:
  360. text_title = "后跟下踩设计"
  361. text_sub_title = self.get_text_value("细节副标题-3")
  362. if not text_sub_title:
  363. text_sub_title = "单鞋&拖鞋 随时切换"
  364. pp_text_title = PictureProcessing().get_text_image_advanced(
  365. font=font_title,
  366. text=text_title,
  367. fill=text_fill,
  368. return_mode="min_image",
  369. )
  370. pp_text_sub_title = PictureProcessing().get_text_image_advanced(
  371. font=font_sub,
  372. text=text_sub_title,
  373. fill=text_fill,
  374. return_mode="min_image",
  375. )
  376. bg_image.paste_img(top_img=pp_text_title, base="en", value=(108, 158))
  377. bg_image.paste_img(top_img=pp_text_sub_title, base="en", value=(108, 578))
  378. goods_art_no_list = list(self.data.keys())
  379. _, pp_png = self.image_one_pic(
  380. return_orign=True,
  381. goods_art_no=goods_art_no_list[0],
  382. name="侧视",
  383. )
  384. pp_png = pp_png.resize(value=bg_image.width * 2)
  385. bg_image.paste_img(top_img=pp_png, base="cs", value=(-pp_png.width / 3.5, 100))
  386. detailed_images.append(bg_image)
  387. return PictureProcessing(im=self.add_pic(detailed_images))
  388. # 模特图
  389. def deal_pic_6_2(self):
  390. if self.get_text_value("模特图"):
  391. return self.concatAigcImage(self.get_text_value("模特图"),resize=1600)
  392. else:
  393. return
  394. # 场景图
  395. def deal_pic_6_3(self):
  396. if self.get_text_value("场景图"):
  397. return self.concatAigcImage(self.get_text_value("场景图"),resize=1600)
  398. else:
  399. return
  400. # 场景图--产品展示
  401. def deal_pic_7(self):
  402. detailed_images = []
  403. top_image = PictureProcessing(r"{}\7.jpg".format(self.root))
  404. text_fill = (0, 0, 0)
  405. font_title = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 60)
  406. font_sub = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 40)
  407. detailed_images.append(top_image)
  408. goods_art_no_list = list(self.data.keys())
  409. for goods_info in goods_art_no_list:
  410. pp_jpg_1_list = []
  411. pp_png_1_list = []
  412. for goods_item in goods_art_no_list:
  413. pp_jpg, pp_png = self.image_one_pic(
  414. return_orign=True,
  415. goods_art_no=goods_item,
  416. name="俯视",
  417. )
  418. pp_jpg_1_list.append(pp_jpg)
  419. pp_png_1_list.append(pp_png)
  420. x, y = 0, 0
  421. pp_bg_jpg = PictureProcessing("RGB", (1600, 1600), (255, 255, 255))
  422. _resize_value = (
  423. top_image.width if len(pp_jpg_1_list) == 1 else top_image.width - 300
  424. )
  425. for index, pp_jpg in enumerate(pp_jpg_1_list):
  426. pp_jpg = pp_jpg.resize(value=_resize_value + 100 * index)
  427. pp_bg_jpg = pp_bg_jpg.to_overlay_pic_advance(
  428. top_img=pp_jpg, value=(x, y)
  429. )
  430. x += 180
  431. y += 60
  432. x, y = 0, 0
  433. pp_bg_png = PictureProcessing("RGBA", (1600, 1600), (255, 255, 255, 0))
  434. for index, pp_png in enumerate(pp_png_1_list):
  435. pp_png = pp_png.resize(value=_resize_value + 100 * index)
  436. pp_bg_png = pp_bg_png.paste_img(top_img=pp_png, value=(x, y))
  437. x += 180
  438. y += 60
  439. min_bbox = pp_bg_png.getbbox()
  440. min_bbox = PictureProcessing().expand_bbox(min_bbox)
  441. pp_bg_jpg = pp_bg_jpg.crop(bbox=min_bbox)
  442. pp_bg_png = pp_bg_png.crop(bbox=min_bbox)
  443. pp_bg_1 = PictureProcessing(
  444. "RGB", (top_image.width, pp_bg_jpg.height), (255, 255, 255)
  445. )
  446. pp_bg_1 = pp_bg_1.to_overlay_pic_advance(
  447. top_img=pp_bg_jpg, top_png_img=pp_bg_png, base="cc"
  448. )
  449. pp_text_title = PictureProcessing().get_text_image_advanced(
  450. font=font_title,
  451. text="45°侧视/SIDE",
  452. fill=text_fill,
  453. return_mode="min_image",
  454. )
  455. pp_bg_1.paste_img(top_img=pp_text_title, base="cs", value=(0, 0))
  456. color_pic_list_1 = []
  457. pp_jpg_ceshi, pp_png_ceshi = self.image_one_pic(
  458. return_orign=True,
  459. goods_art_no=goods_item,
  460. name="侧视",
  461. )
  462. pp_jpg_hougen, pp_png_hougen = self.image_one_pic(
  463. return_orign=True,
  464. goods_art_no=goods_item,
  465. name="后跟",
  466. )
  467. pp_jpg_neili, pp_png_neili = self.image_one_pic(
  468. return_orign=True,
  469. goods_art_no=goods_item,
  470. name="内里",
  471. )
  472. pp_jpg_xiedi, pp_png_xiedi = self.image_one_pic(
  473. return_orign=True,
  474. goods_art_no=goods_item,
  475. name="鞋底",
  476. )
  477. pp_png_ceshi = pp_png_ceshi.resize(value=pp_bg_jpg.width / 3)
  478. text_image = PictureProcessing().get_text_image_advanced(
  479. font=font_sub,
  480. text="180°侧面/SIDE",
  481. fill=(0, 0, 0),
  482. return_mode="min_image",
  483. )
  484. backImage = PictureProcessing(
  485. "RGB", (top_image.width / 2, 400), (255, 255, 255)
  486. )
  487. backImage.paste_img(top_img=text_image, base="cs", value=(0, 0))
  488. backImage.paste_img(top_img=pp_png_ceshi, base="cs", value=(0, 30))
  489. color_pic_list_1.append(backImage)
  490. pp_png_hougen = pp_png_hougen.resize(value=pp_bg_jpg.width / 4.5)
  491. text_image = PictureProcessing().get_text_image_advanced(
  492. font=font_sub,
  493. text="背面/BACK",
  494. fill=(0, 0, 0),
  495. return_mode="min_image",
  496. )
  497. backImage = PictureProcessing(
  498. "RGB", (top_image.width / 2, 400), (255, 255, 255)
  499. )
  500. backImage.paste_img(top_img=text_image, base="cs", value=(0, 0))
  501. backImage.paste_img(top_img=pp_png_hougen, base="cs", value=(0, 30))
  502. color_pic_list_1.append(backImage)
  503. pp_png_neili = pp_png_neili.resize(value=pp_bg_jpg.width / 3)
  504. text_image = PictureProcessing().get_text_image_advanced(
  505. font=font_sub,
  506. text="鞋面/VAMP",
  507. fill=(0, 0, 0),
  508. return_mode="min_image",
  509. )
  510. backImage = PictureProcessing(
  511. "RGB", (top_image.width / 2, 400), (255, 255, 255)
  512. )
  513. backImage.paste_img(top_img=text_image, base="cs", value=(-10, 0))
  514. backImage.paste_img(top_img=pp_png_neili, base="cs", value=(-10, 30))
  515. color_pic_list_1.append(backImage)
  516. pp_png_xiedi = pp_png_xiedi.resize(value=pp_bg_jpg.width / 3)
  517. text_image = PictureProcessing().get_text_image_advanced(
  518. font=font_sub,
  519. text="鞋底/BOTTOM",
  520. fill=(0, 0, 0),
  521. return_mode="min_image",
  522. )
  523. backImage = PictureProcessing(
  524. "RGB", (top_image.width / 2, 400), (255, 255, 255)
  525. )
  526. backImage.paste_img(top_img=text_image, base="cs", value=(0, 0))
  527. backImage.paste_img(top_img=pp_png_xiedi, base="cs", value=(0, 30))
  528. color_pic_list_1.append(backImage)
  529. all_color_pp = PictureProcessing(
  530. "RGB", (top_image.width, 1600), (255, 255, 255)
  531. ).horizontal_distribution(
  532. color_pic_list_1,
  533. bg_width=top_image.width,
  534. line_spacing=10,
  535. number_per_row=2,
  536. )
  537. detailed_images.append(pp_bg_1)
  538. detailed_images.append(all_color_pp)
  539. bottomImage = PictureProcessing(
  540. "RGB", (top_image.width, 200), (255, 255, 255)
  541. )
  542. detailed_images.append(bottomImage)
  543. return PictureProcessing(im=self.add_pic(detailed_images))
  544. # # 添加注意事项
  545. def deal_pic_8(self):
  546. detailed_images = []
  547. detailed_images.append(PictureProcessing(r"{}\10.jpg".format(self.root)))
  548. return PictureProcessing(im=self.add_pic(detailed_images))