detail_xinnuo3.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. """
  2. 步骤:
  3. 1、整理需要处理的款号图-输出款号图文件夹
  4. 2、整理所有相关的图片作为素材图
  5. 3、按要求进行拼接
  6. """
  7. from ast import mod
  8. import os
  9. import settings
  10. from PIL import ImageFont
  11. import copy
  12. # from module.view_control.generate_goods_no_detail_pic.detail_generate_base import DetailBase
  13. # from module.view_control.generate_goods_no_detail_pic.pic_deal import PictureProcessing
  14. is_test_plugins = False
  15. try:
  16. is_test_plugins = settings.is_test_plugins
  17. except:
  18. is_test_plugins = False
  19. if is_test_plugins:
  20. from custom_plugins.plugins_mode.detail_generate_base import DetailBase
  21. from custom_plugins.plugins_mode.pic_deal import PictureProcessing
  22. else:
  23. from plugins_mode.detail_generate_base import DetailBase
  24. from plugins_mode.pic_deal import PictureProcessing
  25. plugins_name = "详情模板"
  26. company_name_list = ["信诺"]
  27. template_name = "xinnuo-3"
  28. # "俯视", "侧视", "后跟", "鞋底", "内里" 组合,组合2
  29. class DetailPicGet(DetailBase):
  30. need_view = ["俯视", "侧视", "后跟", "鞋底", "内里","组合","组合2","组合3","组合4"]
  31. root = r"{}\resources\detail_temp\xinnuo\3".format(os.getcwd())
  32. def __init__(
  33. self,
  34. goods_no,
  35. goods_no_value: dict,
  36. out_put_dir,
  37. windows=None,
  38. test=False,
  39. excel_data=None,
  40. assigned_page_list=None,
  41. ):
  42. super().__init__(
  43. goods_no,
  44. goods_no_value,
  45. out_put_dir,
  46. windows=windows,
  47. excel_data=excel_data,
  48. assigned_page_list=assigned_page_list,
  49. )
  50. self.template_name = template_name
  51. self.root = r"{}\resources\detail_temp\xinnuo\3".format(os.getcwd())
  52. print("run xinnuo-3 ")
  53. self.base_bg_color = (255, 255, 255)
  54. self.base_bg_color_2 = (244, 242, 243)
  55. self.deal_pic_func_list = [
  56. self.deal_pic_1,
  57. self.deal_pic_2,
  58. self.deal_pic_3,
  59. self.deal_pic_4,
  60. self.deal_pic_5,
  61. self.deal_pic_6,
  62. ]
  63. if test:
  64. # pp = self.generate_font_list_to_pic()
  65. # pp.im.save(r"C:\Users\gymmc\Desktop\细节图示例/字号.png")
  66. # for k, v in self.goods_no_value.items():
  67. # print(k, v)
  68. self.run_test()
  69. else:
  70. self.run_all()
  71. def run_test(self):
  72. detailed_images = []
  73. detailed_images.append(self.deal_pic_1())
  74. detailed_images.append(self.deal_pic_2())
  75. detailed_images.append(self.deal_pic_3())
  76. detailed_images.append(self.deal_pic_4())
  77. detailed_images.append(self.deal_pic_5())
  78. detailed_images.append(self.deal_pic_6())
  79. img = self.add_pic(detailed_images)
  80. img.save(r"{}/{}.jpg".format(self.out_put_dir, self.goods_no, format="JPEG"))
  81. img.show()
  82. def deal_pic_1(self):
  83. pp_bg = PictureProcessing(r"{}\1.jpg".format(self.root),1600)
  84. goods_art_no_list = list(self.data.keys())
  85. pp_jpg_1, pp_png_1 = self.image_one_pic(
  86. return_orign=True,
  87. goods_art_no=goods_art_no_list[0],
  88. name="组合",
  89. )
  90. if pp_png_1 != None and pp_jpg_1 != None:
  91. pp_jpg_1 = pp_jpg_1.resize(value=pp_bg.width/1.1)
  92. pp_png_1 = pp_png_1.resize(value=pp_bg.width /1.1)
  93. if self.check_shoe_is_right_by_pixel(im=pp_png_1.im)==False:
  94. pp_jpg_1 = pp_jpg_1.transpose()
  95. pp_png_1 = pp_png_1.transpose()
  96. # pp_png_1_bg = PictureProcessing("RGBA", (pp_jpg_1.width*1.4, pp_jpg_1.width*1.4), (255,255,255,0))
  97. # pp_png_1_bg = pp_png_1_bg.paste_img(
  98. # top_img=pp_png_1,base="nc", value=(0, 0)
  99. # )
  100. # pp_png_1_bg = pp_png_1_bg.rotate(0)
  101. #
  102. # pp_bg = pp_bg.paste_img(
  103. # top_img=pp_png_1_bg,base="cc", value=(25, 340)
  104. # )
  105. pp_bg = pp_bg.to_overlay_pic_advance(
  106. mode="pixel",
  107. top_img=pp_jpg_1,
  108. base="cc",
  109. value=(25, 50),
  110. top_png_img=pp_png_1,
  111. )
  112. return pp_bg
  113. def deal_pic_2(self):
  114. pp_bg = PictureProcessing(r"{}\2.jpg".format(self.root), 1600)
  115. goods_art_no_list = list(self.data.keys())
  116. pp_jpg_1, pp_png_1 = self.image_one_pic(
  117. return_orign=True,
  118. goods_art_no=goods_art_no_list[0],
  119. name="俯视",
  120. )
  121. pp_jpg_1 = pp_jpg_1.resize(value=pp_bg.width*0.45)
  122. pp_png_1 = pp_png_1.resize(value=pp_bg.width*0.45)
  123. # pp_bg = pp_bg.paste_img(top_img=shoe_bg, value=(0, 0), base="nw")
  124. pp_bg = pp_bg.to_overlay_pic_advance(
  125. mode="pixel",
  126. top_img=pp_jpg_1,
  127. base="cc",
  128. value=(0, 70),
  129. top_png_img=pp_png_1,
  130. )
  131. font = ImageFont.truetype(
  132. r"resources\ttf\puhui\Medium.ttf", 24
  133. ) # 设计理念
  134. font_hei = ImageFont.truetype(r"resources\ttf\simhei.ttf", 24) # 设计理念
  135. xiemian = self.get_text_value("鞋面")
  136. xiedian = self.get_text_value("鞋垫")
  137. neili = self.get_text_value("内里")
  138. xiedi = self.get_text_value("鞋底")
  139. zhangkuan = self.get_text_value("掌宽")
  140. gengao = self.get_text_value("跟高")
  141. pp_bg.get_text_image_advanced(
  142. value=(264, 681),
  143. font=font,
  144. text=xiemian,
  145. align="left",
  146. # anchor="ma",
  147. spacing=5,
  148. fill=(52, 52, 52),
  149. return_mode="image",
  150. margins=(0, 0, 0, 0),
  151. max_len_one_line=6
  152. )
  153. pp_bg.get_text_image_advanced(
  154. value=(611, 681),
  155. font=font,
  156. text=neili,
  157. align="left",
  158. # anchor="ma",
  159. spacing=5,
  160. fill=(52, 52, 52),
  161. return_mode="image",
  162. margins=(0, 0, 0, 0),
  163. max_len_one_line=6
  164. )
  165. pp_bg.get_text_image_advanced(
  166. value=(611, 760),
  167. font=font,
  168. text=xiedi,
  169. align="left",
  170. # anchor="ma",
  171. spacing=5,
  172. fill=(52, 52, 52),
  173. return_mode="image",
  174. margins=(0, 0, 0, 0),
  175. max_len_one_line=6
  176. )
  177. pp_bg.get_text_image_advanced(
  178. value=(264, 760),
  179. font=font,
  180. text=xiedian,
  181. align="left",
  182. # anchor="ma",
  183. spacing=5,
  184. fill=(52, 52, 52),
  185. return_mode="image",
  186. margins=(0, 0, 0, 0),
  187. max_len_one_line=6
  188. )
  189. pp_bg.get_text_image_advanced(
  190. value=(212, 409),
  191. font=font_hei,
  192. text=f"掌宽\n{zhangkuan}",
  193. align="left",
  194. # anchor="ma",
  195. spacing=5,
  196. fill=(52, 52, 52),
  197. return_mode="image",
  198. margins=(0, 0, 0, 0),
  199. )
  200. pp_bg.get_text_image_advanced(
  201. value=(588, 469),
  202. font=font_hei,
  203. text=f"跟高\n{gengao}",
  204. align="left",
  205. # anchor="ma",
  206. spacing=5,
  207. fill=(52, 52, 52),
  208. return_mode="image",
  209. margins=(0, 0, 0, 0),
  210. )
  211. return pp_bg
  212. def deal_pic_3(self):
  213. detailed_images = []
  214. pp_bg = PictureProcessing(r"{}\3.jpg".format(self.root))
  215. goods_art_no_list = list(self.data.keys())
  216. all_color_name = []
  217. bg_color = (247, 247, 247)
  218. text_color = (52, 52, 52)
  219. font = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 25)
  220. goods_art_images = []
  221. total_height = 0
  222. for index, goods_art_no in enumerate(goods_art_no_list):
  223. pp_jpg,pp_png = self.image_one_pic(
  224. goods_art_no=goods_art_no,
  225. name="侧视",
  226. return_orign=True,
  227. )
  228. if pp_jpg is None:
  229. continue
  230. pp_jpg = pp_jpg.resize(value=pp_bg.width / 2.5)
  231. pp_png = pp_png.resize(value=pp_bg.width / 2.5)
  232. color_name = self.goods_no_value["货号资料"][index]["颜色名称"]
  233. all_color_name.append(color_name)
  234. text_bg = PictureProcessing("RGBA", (pp_jpg.width, 50), (255,255,255,0))
  235. text_bg = text_bg.get_text_image_advanced(
  236. value=(0, 0),
  237. font=font,
  238. text="{}".format(color_name),
  239. # text="{}".format(color_name),
  240. align="center",
  241. # anchor="mm",
  242. spacing=5,
  243. fill=text_color,
  244. return_mode="image",
  245. margins=(0, 0, 0, 0),
  246. )
  247. _bg = PictureProcessing(
  248. "RGB",
  249. (pp_bg.width / 2, pp_jpg.height+200),
  250. bg_color,
  251. )
  252. if (index+1) == 1:
  253. total_height += _bg.height
  254. if (index + 1) % 2 != 0 and (index + 1) != 1:
  255. total_height += _bg.height
  256. _bg = _bg.to_overlay_pic_advance(top_img=pp_jpg,top_png_img=pp_png, base="center")
  257. _bg = _bg.paste_img(
  258. top_img=text_bg, value=(pp_jpg.width / 2+10, pp_jpg.height+100)
  259. )
  260. goods_art_images.append(_bg)
  261. rows = 2
  262. shoes_bg = PictureProcessing(
  263. ).horizontal_distribution(
  264. pp_list=goods_art_images,
  265. bg_width=pp_bg.width,
  266. margins=(0, 0, 0, 0),
  267. line_spacing=0,
  268. number_per_row=rows,
  269. )
  270. main_bg = PictureProcessing(
  271. "RGB",
  272. (pp_bg.width, total_height),
  273. bg_color,
  274. )
  275. main_bg.paste_img(top_img=shoes_bg)
  276. detailed_images.append(main_bg)
  277. return PictureProcessing(im=self.add_pic(detailed_images))
  278. return pp_bg
  279. def deal_pic_4(self):
  280. pp_bg = PictureProcessing(r"{}\4.jpg".format(self.root))
  281. return pp_bg
  282. def deal_pic_5(self):
  283. detailed_images = []
  284. bg_image = PictureProcessing(r"{}\5.jpg".format(self.root))
  285. goods_art_no_list = list(self.data.keys())
  286. pp_jpg1, pp_png1 = self.image_one_pic(goods_art_no=goods_art_no_list[0], name="俯视", return_orign=True)
  287. ppg_width=bg_image.width*0.62
  288. ppg_height=bg_image.width*0.62*(329/481)
  289. pph=ppg_height*2
  290. ppw=(pp_png1.width/pp_png1.height)*pph
  291. pp_png1=pp_png1.resize(value=bg_image.width*1)
  292. pp_jpg1=pp_jpg1.resize(value=bg_image.width*1)
  293. pp_png1 = pp_png1.rotate(15)
  294. new_pp1_bg=PictureProcessing("RGB",(ppg_width,ppg_height),(255,255,255))
  295. new_pp1_bg=new_pp1_bg.paste_img(
  296. mode="pixel",top_img=pp_png1,base="sw",value=(0, 0)
  297. )
  298. bg_image=bg_image.paste_img(
  299. mode="pixel",top_img=new_pp1_bg,base="en",value=(20, 205)
  300. )
  301. pp_jpg1, pp_png1 = self.image_one_pic(goods_art_no=goods_art_no_list[0], name="组合4", return_orign=True)
  302. if pp_jpg1 != None or pp_png1 != None:
  303. ppg_width=bg_image.width*0.5
  304. ppg_height=bg_image.width*0.5*(329/428)
  305. pph=ppg_height*2
  306. # ppw=(pp_png1.width/pp_png1.height)*pph
  307. pp_png1=pp_png1.resize(value=bg_image.width)
  308. pp_jpg1=pp_jpg1.resize(value=bg_image.width)
  309. new_pp1_bg=PictureProcessing("RGB",(ppg_width,ppg_height),(200,200,200))
  310. new_pp1_bg=new_pp1_bg.paste_img(
  311. mode="pixel",top_img=pp_png1,base="cc",value=(0, 0)
  312. )
  313. bg_image=bg_image.paste_img(
  314. mode="pixel",top_img=new_pp1_bg,base="nw",value=(20, 205+366)
  315. )
  316. pp_png1, pp_jpg1 = self.image_one_pic(goods_art_no=goods_art_no_list[0], name="俯视", return_orign=True)
  317. if pp_png1 != None and pp_jpg1 != None:
  318. ppg_width=bg_image.width*0.62
  319. ppg_height=bg_image.width*0.62*(329/481)
  320. pph=ppg_height*2
  321. # ppw=(pp_png1.width/pp_png1.height)*pph
  322. pp_png1=pp_png1.resize(value=bg_image.width*1)
  323. pp_jpg1=pp_jpg1.resize(value=bg_image.width*1)
  324. # pp_png1 = pp_png1.rotate(30)
  325. temp_pp1_bg=PictureProcessing("RGB",(ppg_width*2,ppg_width*2),(255,255,255))
  326. temp_pp1_bg = temp_pp1_bg.paste_img(
  327. mode="pixel",top_img=pp_jpg1,base="wc",value=(0, 0)
  328. )
  329. temp_pp1_bg = temp_pp1_bg.rotate(30)
  330. new_pp1_bg=PictureProcessing("RGB",(ppg_width,ppg_height),(255,255,255))
  331. new_pp1_bg=new_pp1_bg.paste_img(
  332. mode="pixel",top_img=temp_pp1_bg,base="en",value=(-350, -280)
  333. )
  334. bg_image=bg_image.paste_img(
  335. mode="pixel",top_img=new_pp1_bg,base="en",value=(20, 205+366*2)
  336. )
  337. pp_jpg1, pp_png1 = self.image_one_pic(goods_art_no=goods_art_no_list[0], name="鞋底", return_orign=True)
  338. if pp_jpg1 != None and pp_png1 != None:
  339. ppg_width=bg_image.width*0.62
  340. ppg_height=bg_image.width*0.62*(329/481)
  341. # pph=ppg_height*2
  342. # ppw=(pp_png1.width/pp_png1.height)*pph
  343. pp_png1=pp_png1.resize(value=bg_image.width*1)
  344. pp_jpg1=pp_jpg1.resize(value=bg_image.width*1)
  345. temp_pp1_bg=PictureProcessing("RGB",(ppg_width*2,ppg_width*2),(255,255,255))
  346. temp_pp1_bg = temp_pp1_bg.paste_img(
  347. mode="pixel",top_img=pp_jpg1,base="wc",value=(0, 0)
  348. )
  349. temp_pp1_bg = temp_pp1_bg.rotate(-45)
  350. # pp_png1 = pp_png1.rotate(-45)
  351. new_pp1_bg=PictureProcessing("RGB",(ppg_width,ppg_height),(255,255,255))
  352. new_pp1_bg=new_pp1_bg.paste_img(
  353. mode="pixel",top_img=temp_pp1_bg,base="wc",value=(-120, 150)
  354. )
  355. # new_pp1_bg = new_pp1_bg.to_overlay_pic_advance(
  356. # top_img=pp_jpg1, top_png_img=pp_png1, base="wc", value=(0, 0)
  357. # )
  358. bg_image=bg_image.paste_img(
  359. mode="pixel",top_img=new_pp1_bg,base="nw",value=(20, 205+366*3)
  360. )
  361. font_title = ImageFont.truetype(
  362. r"resources\ttf\puhui\Regular.ttf", 31
  363. )
  364. font_desc = ImageFont.truetype(
  365. r"resources\ttf\puhui\Regular.ttf", 20
  366. )
  367. text_list=[{'name':'细节1标题','align':'left','max_len':16,'default':'牛皮鞋面','value':(69, 281-10)},
  368. {'name':'细节1内容','align':'left','max_len':16,'default':'质感真皮鞋面 柔韧有型','value':(69, 332-10)},
  369. {'name':'细节2标题','align':'right','max_len':16,'default':'可调节式魔术贴','value':(500, 649-10)},
  370. {'name':'细节2内容','align':'right','max_len':16,'default':'穿脱随心方便舒适','value':(562, 700-10)},
  371. {'name':'细节3标题','align':'left','max_len':16,'default':'舒软鞋垫','value':(69, 1016-10)},
  372. {'name':'细节3内容','align':'left','max_len':16,'default':'沙发感鞋垫 契合足型','value':(69, 1066-10)},
  373. {'name':'细节4标题','align':'right','max_len':16,'default':'柔韧鞋底','value':(595, 1384-10)},
  374. {'name':'细节4内容','align':'right','max_len':16,'default':'舒适耐穿 畅快出行','value':(555, 1434-10)}
  375. ]
  376. for item in text_list:
  377. name = self.get_text_value(item['name'])
  378. if name== None:
  379. name = item['default']
  380. if '标题' in item['name']:
  381. bg_image.get_text_image_advanced(
  382. value=item['value'],
  383. font=font_title,
  384. text=name,
  385. align=item['align'],
  386. # anchor="ma",
  387. spacing=5,
  388. fill=(0, 0, 0),
  389. return_mode="image",
  390. margins=(0, 0, 0, 0),
  391. max_len_one_line=item['max_len']
  392. )
  393. else:
  394. bg_image.get_text_image_advanced(
  395. value=item['value'],
  396. font=font_desc,
  397. text=name,
  398. align=item['align'],
  399. # anchor="ma",
  400. spacing=5,
  401. fill=(187, 187, 187),
  402. return_mode="image",
  403. margins=(0, 0, 0, 0),
  404. max_len_one_line=item['max_len']
  405. )
  406. detailed_images.append(bg_image)
  407. return PictureProcessing(im=self.add_pic(detailed_images))
  408. def deal_pic_6(self):
  409. detailed_images = []
  410. image_path = r"{}\6.jpg".format(self.root)
  411. pp_bg = PictureProcessing(image_path,1600)
  412. goods_art_no_list = list(self.data.keys())
  413. font = ImageFont.truetype(
  414. r"resources\ttf\puhui\Regular.ttf", 18
  415. )
  416. # pp_bg_new = copy.deepcopy(pp_bg)
  417. bg_height=179
  418. pp_jpg_1, pp_png_1 = self.image_one_pic(
  419. return_orign=True,
  420. goods_art_no=goods_art_no_list[0],
  421. name='组合',
  422. )
  423. if pp_jpg_1 != None and pp_png_1 != None:
  424. # if self.check_shoe_is_right_by_pixel(im=pp_png_1.im):
  425. # pp_jpg_1 = pp_jpg_1.transpose()
  426. # pp_png_1 = pp_png_1.transpose()
  427. pp_jpg_1 = pp_jpg_1.resize(value=pp_bg.width / 1.7)
  428. pp_png_1 = pp_png_1.resize(value=pp_bg.width / 1.7)
  429. pp_bg = pp_bg.to_overlay_pic_advance(
  430. top_img=pp_jpg_1, top_png_img=pp_png_1, base="nc", value=(0, 270)
  431. )
  432. bg_height=683
  433. pp_bg.get_text_image_advanced(
  434. value=(310,610),
  435. font=font,
  436. text="正面45°/ FRONT45°",
  437. align="center",
  438. # anchor="ma",
  439. spacing=5,
  440. return_mode="image",
  441. margins=(0, 0, 0, 0),
  442. max_len_one_line=20
  443. )
  444. pp_jpg_1, pp_png_1 = self.image_one_pic(
  445. return_orign=True,
  446. goods_art_no=goods_art_no_list[0],
  447. name='组合2',
  448. )
  449. if pp_jpg_1 != None and pp_png_1 != None:
  450. # if self.check_shoe_is_right_by_pixel(im=pp_png_1.im):
  451. # pp_jpg_1 = pp_jpg_1.transpose()
  452. # pp_png_1 = pp_png_1.transpose()
  453. pp_jpg_1 = pp_jpg_1.resize(value=pp_bg.width / 1.7)
  454. pp_png_1 = pp_png_1.resize(value=pp_bg.width / 1.7)
  455. pp_bg = pp_bg.to_overlay_pic_advance(
  456. top_img=pp_jpg_1, top_png_img=pp_png_1, base="nc", value=(0, 720)
  457. )
  458. bg_height=1086
  459. pp_bg.get_text_image_advanced(
  460. value=(315,1020),
  461. font=font,
  462. text="背面45°/ BACK45°",
  463. align="center",
  464. # anchor="ma",
  465. spacing=5,
  466. return_mode="image",
  467. margins=(0, 0, 0, 0),
  468. max_len_one_line=20
  469. )
  470. pp_jpg_1, pp_png_1 = self.image_one_pic(
  471. return_orign=True,
  472. goods_art_no=goods_art_no_list[0],
  473. name='后跟',
  474. )
  475. if pp_jpg_1 != None and pp_png_1 != None:
  476. # if self.check_shoe_is_right_by_pixel(im=pp_png_1.im):
  477. # pp_jpg_1 = pp_jpg_1.transpose()
  478. # pp_png_1 = pp_png_1.transpose()
  479. pp_jpg_1 = pp_jpg_1.resize(value=pp_bg.width / 5)
  480. pp_png_1 = pp_png_1.resize(value=pp_bg.width / 5)
  481. pp_jpg_2 = pp_jpg_1.transpose()
  482. pp_png_2 = pp_png_1.transpose()
  483. pp_bg = pp_bg.to_overlay_pic_advance(
  484. top_img=pp_jpg_1, top_png_img=pp_png_1, base="nc", value=(-80, 1150)
  485. )
  486. pp_bg = pp_bg.to_overlay_pic_advance(
  487. top_img=pp_jpg_2, top_png_img=pp_png_2, base="nc", value=(80, 1150)
  488. )
  489. bg_height=1600
  490. pp_bg.get_text_image_advanced(
  491. value=(350,1530),
  492. font=font,
  493. text="侧面/ SIDE",
  494. align="center",
  495. # anchor="ma",
  496. spacing=5,
  497. return_mode="image",
  498. margins=(0, 0, 0, 0),
  499. max_len_one_line=20
  500. )
  501. pp_jpg_1, pp_png_1 = self.image_one_pic(
  502. return_orign=True,
  503. goods_art_no=goods_art_no_list[0],
  504. name='组合3',
  505. )
  506. if pp_jpg_1 != None and pp_png_1 != None:
  507. # if self.check_shoe_is_right_by_pixel(im=pp_png_1.im):
  508. # pp_jpg_1 = pp_jpg_1.transpose()
  509. # pp_png_1 = pp_png_1.transpose()
  510. pp_jpg_1 = pp_jpg_1.resize(value=pp_bg.width / 1.7)
  511. pp_png_1 = pp_png_1.resize(value=pp_bg.width / 1.7)
  512. pp_bg = pp_bg.to_overlay_pic_advance(
  513. top_img=pp_jpg_1, top_png_img=pp_png_1, base="nc", value=(0, 1750)
  514. )
  515. bg_height=2395
  516. pp_bg.get_text_image_advanced(
  517. value=(353,2270),
  518. font=font,
  519. text="顶面/ TOP",
  520. align="center",
  521. # anchor="ma",
  522. spacing=5,
  523. return_mode="image",
  524. margins=(0, 0, 0, 0),
  525. max_len_one_line=20
  526. )
  527. temp_pp1_bg=PictureProcessing("RGB",(pp_bg.width,bg_height),(255,255,255))
  528. temp_pp1_bg=temp_pp1_bg.paste_img(
  529. mode="pixel",top_img=pp_bg,base="nw",value=(0, 0)
  530. )
  531. detailed_images.append(temp_pp1_bg)
  532. return self.pp_pic_subsection(
  533. PictureProcessing(im=self.add_pic(detailed_images))
  534. )
  535. if __name__ == "__main__":
  536. d = DetailPicGet(
  537. goods_no="test",
  538. goods_no_value={},
  539. out_put_dir="./output/xinnuo-3",
  540. test=True,
  541. )
  542. d.run_test()