detail_huilima5.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  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. _pp = PictureProcessing().get_text_image_advanced(
  100. font=font_main,
  101. text=main_text,
  102. fill=(0, 0, 0),
  103. spacing=20,
  104. return_mode="min_image",
  105. )
  106. _pp_sub = PictureProcessing().get_text_image_advanced(
  107. font=font_sub,
  108. text=sub_text,
  109. fill=(0, 0, 0),
  110. return_mode="min_image",
  111. )
  112. pp_bg_1 = pp_bg_1.paste_img(top_img=_pp, value=(0, 232), base="cs")
  113. pp_bg_1 = pp_bg_1.paste_img(top_img=_pp_sub, value=(0, 446), base="cs")
  114. goods_art_no_list = list(self.data.keys())
  115. pp_jpg_1_list = []
  116. pp_png_1_list = []
  117. pp_jpg, pp_png = self.image_one_pic(
  118. return_orign=True,
  119. goods_art_no=goods_art_no_list[0],
  120. name="俯视",
  121. )
  122. pp_jpg_1_list.append(pp_jpg)
  123. pp_jpg_1_list.append(pp_jpg)
  124. pp_png_1_list.append(pp_png)
  125. pp_png_1_list.append(pp_png)
  126. x, y = 0, 0
  127. pp_bg_jpg = PictureProcessing("RGB", (1600, 1600), (255, 255, 255))
  128. _resize_value = (
  129. pp_bg_1.width if len(pp_jpg_1_list) == 1 else pp_bg_1.width - 300
  130. )
  131. for index, pp_jpg in enumerate(pp_jpg_1_list):
  132. pp_jpg = pp_jpg.resize(value=_resize_value + 100 * index)
  133. pp_bg_jpg = pp_bg_jpg.to_overlay_pic_advance(top_img=pp_jpg, value=(x, y))
  134. x += 180
  135. y += 60
  136. x, y = 0, 0
  137. pp_bg_png = PictureProcessing("RGBA", (1600, 1600), (255, 255, 255, 0))
  138. for index, pp_png in enumerate(pp_png_1_list):
  139. pp_png = pp_png.resize(value=_resize_value + 100 * index)
  140. pp_bg_png = pp_bg_png.paste_img(top_img=pp_png, value=(x, y))
  141. x += 180
  142. y += 60
  143. min_bbox = pp_bg_png.getbbox()
  144. min_bbox = PictureProcessing().expand_bbox(min_bbox)
  145. pp_bg_jpg = pp_bg_jpg.crop(bbox=min_bbox)
  146. pp_bg_png = pp_bg_png.crop(bbox=min_bbox)
  147. pp_bg_1 = pp_bg_1.to_overlay_pic_advance(
  148. top_img=pp_bg_jpg, top_png_img=pp_bg_png, base="cc"
  149. )
  150. detailed_images.append(pp_bg_1)
  151. # detailed_images.append(pp_bg_2)
  152. return PictureProcessing(im=self.add_pic(detailed_images))
  153. # 展示基础信息
  154. def deal_pic_2(self):
  155. detailed_images = []
  156. pp_bg_2 = PictureProcessing(r"{}\2.jpg".format(self.root))
  157. font_1 = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 130)
  158. font_desc = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 48)
  159. text = self.get_text_value("设计理念-标题")
  160. text_desc = self.get_text_value("设计理念")
  161. _pp = PictureProcessing().get_text_image_advanced(
  162. font=font_1,
  163. text=text,
  164. fill=(0, 0, 0),
  165. return_mode="min_image",
  166. )
  167. _pp_desc = PictureProcessing().get_text_image_advanced(
  168. font=font_desc,
  169. text=text_desc,
  170. fill=(0, 0, 0),
  171. spacing=30,
  172. align="center",
  173. return_mode="min_image",
  174. )
  175. pp_bg_2 = pp_bg_2.paste_img(top_img=_pp, value=(0, 212), base="nc")
  176. pp_bg_2 = pp_bg_2.paste_img(top_img=_pp_desc, value=(0, 533), base="nc")
  177. detailed_images.append(pp_bg_2)
  178. return PictureProcessing(im=self.add_pic(detailed_images))
  179. # 颜色展示
  180. def deal_pic_3(self):
  181. detailed_images = []
  182. pp_bg = PictureProcessing(r"{}\3.jpg".format(self.root))
  183. font_color = ImageFont.truetype(
  184. r"resources\ttf\puhui\Medium.ttf", 34
  185. ) # 颜色名称
  186. color_pic_list_1 = []
  187. for goods_art_no_dict in self.goods_no_value["货号资料"]:
  188. color_name = goods_art_no_dict["颜色名称"]
  189. goods_art_no = goods_art_no_dict["货号"]
  190. pp_jpg = self.get_overlay_pic_from_dict(
  191. goods_art_no=goods_art_no,
  192. color_name="侧视",
  193. bg_color=self.base_bg_color,
  194. )
  195. pp_jpg = pp_jpg.resize(value=pp_bg.width / 2)
  196. pp_jpg = pp_jpg.paste_img_invert(
  197. top_img=PictureProcessing(
  198. "RGBA", (pp_jpg.width, pp_jpg.height + 70), (255, 255, 255, 0)
  199. ),
  200. base="nw",
  201. )
  202. text_image = PictureProcessing().get_text_image_advanced(
  203. font=font_color,
  204. text="{}".format(color_name),
  205. fill=(0, 0, 0),
  206. return_mode="min_image",
  207. )
  208. pp_jpg = pp_jpg.paste_img(top_img=text_image, base="sc", value=(0, 10))
  209. color_pic_list_1.append(pp_jpg)
  210. # 颜色列表进行等分展示
  211. all_color_pp = PictureProcessing().horizontal_distribution(
  212. color_pic_list_1,
  213. bg_width=pp_bg.width - 100,
  214. line_spacing=10,
  215. number_per_row=2,
  216. )
  217. pp_bg.paste_img(top_img=all_color_pp, base="cc", value=(0, -100))
  218. font_category = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 50)
  219. text_xiemian = self.get_text_value("鞋面")
  220. text_xiedi = self.get_text_value("鞋底")
  221. text_neili = self.get_text_value("内里")
  222. text_xiedian = self.get_text_value("鞋垫")
  223. pp_text_xiemian = PictureProcessing().get_text_image_advanced(
  224. font=font_category,
  225. text=text_xiemian,
  226. fill=(0, 0, 0),
  227. return_mode="min_image",
  228. )
  229. pp_text_xiedian = PictureProcessing().get_text_image_advanced(
  230. font=font_category,
  231. text=text_xiedian,
  232. fill=(0, 0, 0),
  233. return_mode="min_image",
  234. )
  235. pp_text_xiedi = PictureProcessing().get_text_image_advanced(
  236. font=font_category,
  237. text=text_xiedi,
  238. fill=(0, 0, 0),
  239. return_mode="min_image",
  240. )
  241. pp_text_neili = PictureProcessing().get_text_image_advanced(
  242. font=font_category,
  243. text=text_neili,
  244. fill=(0, 0, 0),
  245. return_mode="min_image",
  246. )
  247. pp_bg = pp_bg.paste_img(top_img=pp_text_xiemian, value=(416, 960), base="nw")
  248. pp_bg = pp_bg.paste_img(top_img=pp_text_xiedian, value=(416, 1144), base="nw")
  249. pp_bg = pp_bg.paste_img(top_img=pp_text_neili, value=(1157, 960), base="nw")
  250. pp_bg = pp_bg.paste_img(top_img=pp_text_xiedi, value=(1157, 1144), base="nw")
  251. detailed_images.append(pp_bg)
  252. return PictureProcessing(im=self.add_pic(detailed_images))
  253. # 展示细节图
  254. def deal_pic_4(self):
  255. detailed_images = []
  256. bg_image = PictureProcessing(r"{}\4.jpg".format(self.root))
  257. text_fill = (255, 255, 255)
  258. font_title = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 150)
  259. font_sub = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 50)
  260. text_title = self.get_text_value("细节标题-1")
  261. text_sub_title = self.get_text_value("细节副标题-1")
  262. pp_text_title = PictureProcessing().get_text_image_advanced(
  263. font=font_title,
  264. text=text_title,
  265. fill=text_fill,
  266. return_mode="min_image",
  267. )
  268. pp_text_sub_title = PictureProcessing().get_text_image_advanced(
  269. font=font_sub,
  270. text=text_sub_title,
  271. fill=text_fill,
  272. return_mode="min_image",
  273. )
  274. bg_image.paste_img(top_img=pp_text_title, base="en", value=(108, 258))
  275. bg_image.paste_img(top_img=pp_text_sub_title, base="en", value=(108, 578))
  276. goods_art_no_list = list(self.data.keys())
  277. _, pp_png = self.image_one_pic(
  278. return_orign=True,
  279. goods_art_no=goods_art_no_list[0],
  280. name="俯视",
  281. )
  282. pp_png = pp_png.resize(value=bg_image.width * 2)
  283. bg_image.paste_img(top_img=pp_png, base="cs", value=(-pp_png.width / 4, -200))
  284. detailed_images.append(bg_image)
  285. return PictureProcessing(im=self.add_pic(detailed_images))
  286. # 场景图--产品展示
  287. def deal_pic_5(self):
  288. detailed_images = []
  289. bg_image = PictureProcessing(r"{}\5.jpg".format(self.root))
  290. text_fill = (255, 255, 255)
  291. font_title = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 150)
  292. font_sub = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 50)
  293. text_title = self.get_text_value("细节标题-2")
  294. text_sub_title = self.get_text_value("细节副标题-2")
  295. pp_text_title = PictureProcessing().get_text_image_advanced(
  296. font=font_title,
  297. text=text_title,
  298. fill=text_fill,
  299. return_mode="min_image",
  300. )
  301. pp_text_sub_title = PictureProcessing().get_text_image_advanced(
  302. font=font_sub,
  303. text=text_sub_title,
  304. fill=text_fill,
  305. return_mode="min_image",
  306. )
  307. bg_image.paste_img(top_img=pp_text_title, base="nw", value=(115, 369))
  308. bg_image.paste_img(top_img=pp_text_sub_title, base="nw", value=(115, 686))
  309. goods_art_no_list = list(self.data.keys())
  310. _, pp_png = self.image_one_pic(
  311. return_orign=True,
  312. goods_art_no=goods_art_no_list[0],
  313. name="俯视",
  314. )
  315. pp_png = pp_png.resize(value=bg_image.width * 2)
  316. bg_image.paste_img(top_img=pp_png, base="cs", value=(pp_png.width / 4, 0))
  317. detailed_images.append(bg_image)
  318. return PictureProcessing(im=self.add_pic(detailed_images))
  319. # 场景图--产品展示
  320. def deal_pic_6(self):
  321. detailed_images = []
  322. bg_image = PictureProcessing(r"{}\6.jpg".format(self.root))
  323. text_fill = (255, 255, 255)
  324. font_title = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 150)
  325. font_sub = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 50)
  326. text_title = self.get_text_value("细节标题-3")
  327. text_sub_title = self.get_text_value("细节副标题-3")
  328. pp_text_title = PictureProcessing().get_text_image_advanced(
  329. font=font_title,
  330. text=text_title,
  331. fill=text_fill,
  332. return_mode="min_image",
  333. )
  334. pp_text_sub_title = PictureProcessing().get_text_image_advanced(
  335. font=font_sub,
  336. text=text_sub_title,
  337. fill=text_fill,
  338. return_mode="min_image",
  339. )
  340. bg_image.paste_img(top_img=pp_text_title, base="en", value=(108, 158))
  341. bg_image.paste_img(top_img=pp_text_sub_title, base="en", value=(108, 578))
  342. goods_art_no_list = list(self.data.keys())
  343. _, pp_png = self.image_one_pic(
  344. return_orign=True,
  345. goods_art_no=goods_art_no_list[0],
  346. name="侧视",
  347. )
  348. pp_png = pp_png.resize(value=bg_image.width * 2)
  349. bg_image.paste_img(top_img=pp_png, base="cs", value=(-pp_png.width / 3.5, 100))
  350. detailed_images.append(bg_image)
  351. return PictureProcessing(im=self.add_pic(detailed_images))
  352. #模特图
  353. def deal_pic_6_2(self):
  354. if self.get_text_value("模特图"):
  355. mote_img = PictureProcessing(self.get_text_value("模特图"))
  356. mote_img = mote_img.resize(value=1600)
  357. bg_img = PictureProcessing("RGB", (mote_img.width, mote_img.height), (255,255,255))
  358. bg_img = bg_img.paste_img(top_img=mote_img,base="nc", value=(0, 0))
  359. return bg_img
  360. else:
  361. return
  362. #场景图
  363. def deal_pic_6_3(self):
  364. if self.get_text_value("场景图"):
  365. mote_img = PictureProcessing(self.get_text_value("场景图"))
  366. mote_img = mote_img.resize(value=1600)
  367. bg_img = PictureProcessing("RGB", (mote_img.width, mote_img.height+mote_img.height), (255,255,255))
  368. bg_img = bg_img.paste_img(top_img=mote_img,base="nc", value=(0, 0))
  369. return bg_img
  370. else:
  371. return
  372. # 场景图--产品展示
  373. def deal_pic_7(self):
  374. detailed_images = []
  375. top_image = PictureProcessing(r"{}\7.jpg".format(self.root))
  376. text_fill = (0, 0, 0)
  377. font_title = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 60)
  378. font_sub = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 40)
  379. detailed_images.append(top_image)
  380. goods_art_no_list = list(self.data.keys())
  381. for goods_info in goods_art_no_list:
  382. pp_jpg_1_list = []
  383. pp_png_1_list = []
  384. for goods_item in goods_art_no_list:
  385. pp_jpg, pp_png = self.image_one_pic(
  386. return_orign=True,
  387. goods_art_no=goods_item,
  388. name="俯视",
  389. )
  390. pp_jpg_1_list.append(pp_jpg)
  391. pp_png_1_list.append(pp_png)
  392. x, y = 0, 0
  393. pp_bg_jpg = PictureProcessing("RGB", (1600, 1600), (255, 255, 255))
  394. _resize_value = (
  395. top_image.width if len(pp_jpg_1_list) == 1 else top_image.width - 300
  396. )
  397. for index, pp_jpg in enumerate(pp_jpg_1_list):
  398. pp_jpg = pp_jpg.resize(value=_resize_value + 100 * index)
  399. pp_bg_jpg = pp_bg_jpg.to_overlay_pic_advance(
  400. top_img=pp_jpg, value=(x, y)
  401. )
  402. x += 180
  403. y += 60
  404. x, y = 0, 0
  405. pp_bg_png = PictureProcessing("RGBA", (1600, 1600), (255, 255, 255, 0))
  406. for index, pp_png in enumerate(pp_png_1_list):
  407. pp_png = pp_png.resize(value=_resize_value + 100 * index)
  408. pp_bg_png = pp_bg_png.paste_img(top_img=pp_png, value=(x, y))
  409. x += 180
  410. y += 60
  411. min_bbox = pp_bg_png.getbbox()
  412. min_bbox = PictureProcessing().expand_bbox(min_bbox)
  413. pp_bg_jpg = pp_bg_jpg.crop(bbox=min_bbox)
  414. pp_bg_png = pp_bg_png.crop(bbox=min_bbox)
  415. pp_bg_1 = PictureProcessing(
  416. "RGB", (top_image.width, pp_bg_jpg.height), (255, 255, 255)
  417. )
  418. pp_bg_1 = pp_bg_1.to_overlay_pic_advance(
  419. top_img=pp_bg_jpg, top_png_img=pp_bg_png, base="cc"
  420. )
  421. pp_text_title = PictureProcessing().get_text_image_advanced(
  422. font=font_title,
  423. text="45°侧视/SIDE",
  424. fill=text_fill,
  425. return_mode="min_image",
  426. )
  427. pp_bg_1.paste_img(top_img=pp_text_title, base="cs", value=(0, 0))
  428. color_pic_list_1 = []
  429. pp_jpg_ceshi, pp_png_ceshi = self.image_one_pic(
  430. return_orign=True,
  431. goods_art_no=goods_item,
  432. name="侧视",
  433. )
  434. pp_jpg_hougen, pp_png_hougen = self.image_one_pic(
  435. return_orign=True,
  436. goods_art_no=goods_item,
  437. name="后跟",
  438. )
  439. pp_jpg_neili, pp_png_neili = self.image_one_pic(
  440. return_orign=True,
  441. goods_art_no=goods_item,
  442. name="内里",
  443. )
  444. pp_jpg_xiedi, pp_png_xiedi = self.image_one_pic(
  445. return_orign=True,
  446. goods_art_no=goods_item,
  447. name="鞋底",
  448. )
  449. pp_png_ceshi = pp_png_ceshi.resize(value=pp_bg_jpg.width / 3)
  450. text_image = PictureProcessing().get_text_image_advanced(
  451. font=font_sub,
  452. text="180°侧面/SIDE",
  453. fill=(0, 0, 0),
  454. return_mode="min_image",
  455. )
  456. backImage = PictureProcessing(
  457. "RGB", (top_image.width / 2, 400), (255, 255, 255)
  458. )
  459. backImage.paste_img(top_img=text_image, base="cs", value=(0, 0))
  460. backImage.paste_img(top_img=pp_png_ceshi, base="cs", value=(0, 30))
  461. color_pic_list_1.append(backImage)
  462. pp_png_hougen = pp_png_hougen.resize(value=pp_bg_jpg.width / 4.5)
  463. text_image = PictureProcessing().get_text_image_advanced(
  464. font=font_sub,
  465. text="背面/BACK",
  466. fill=(0, 0, 0),
  467. return_mode="min_image",
  468. )
  469. backImage = PictureProcessing(
  470. "RGB", (top_image.width / 2, 400), (255, 255, 255)
  471. )
  472. backImage.paste_img(top_img=text_image, base="cs", value=(0, 0))
  473. backImage.paste_img(top_img=pp_png_hougen, base="cs", value=(0, 30))
  474. color_pic_list_1.append(backImage)
  475. pp_png_neili = pp_png_neili.resize(value=pp_bg_jpg.width / 3)
  476. text_image = PictureProcessing().get_text_image_advanced(
  477. font=font_sub,
  478. text="鞋面/VAMP",
  479. fill=(0, 0, 0),
  480. return_mode="min_image",
  481. )
  482. backImage = PictureProcessing(
  483. "RGB", (top_image.width / 2, 400), (255, 255, 255)
  484. )
  485. backImage.paste_img(top_img=text_image, base="cs", value=(-10, 0))
  486. backImage.paste_img(top_img=pp_png_neili, base="cs", value=(-10, 30))
  487. color_pic_list_1.append(backImage)
  488. pp_png_xiedi = pp_png_xiedi.resize(value=pp_bg_jpg.width / 3)
  489. text_image = PictureProcessing().get_text_image_advanced(
  490. font=font_sub,
  491. text="鞋底/BOTTOM",
  492. fill=(0, 0, 0),
  493. return_mode="min_image",
  494. )
  495. backImage = PictureProcessing(
  496. "RGB", (top_image.width / 2, 400), (255, 255, 255)
  497. )
  498. backImage.paste_img(top_img=text_image, base="cs", value=(0, 0))
  499. backImage.paste_img(top_img=pp_png_xiedi, base="cs", value=(0, 30))
  500. color_pic_list_1.append(backImage)
  501. all_color_pp = PictureProcessing(
  502. "RGB", (top_image.width, 1600), (255, 255, 255)
  503. ).horizontal_distribution(
  504. color_pic_list_1,
  505. bg_width=top_image.width,
  506. line_spacing=10,
  507. number_per_row=2,
  508. )
  509. detailed_images.append(pp_bg_1)
  510. detailed_images.append(all_color_pp)
  511. bottomImage = PictureProcessing(
  512. "RGB", (top_image.width, 200), (255, 255, 255)
  513. )
  514. detailed_images.append(bottomImage)
  515. return PictureProcessing(im=self.add_pic(detailed_images))
  516. # # 添加注意事项
  517. def deal_pic_8(self):
  518. detailed_images = []
  519. detailed_images.append(PictureProcessing(r"{}\10.jpg".format(self.root)))
  520. return PictureProcessing(im=self.add_pic(detailed_images))