去除UI线框,换用默认大图
@ -51,31 +51,34 @@ async def draw_char_card(raw_data: dict, charUrl: str = None) -> str:
|
||||
char_info_1 = Image.open(TEXT_PATH / 'char_info_1.png')
|
||||
char_imfo_mask = Image.open(TEXT_PATH / 'char_info_mask.png')
|
||||
|
||||
based_w, based_h = 320, 1024
|
||||
#based_w, based_h = 320, 1024
|
||||
based_w, based_h = 600, 1200
|
||||
if charUrl:
|
||||
char_img = Image.open(BytesIO(get(charUrl).content)).convert('RGBA')
|
||||
else:
|
||||
char_img = Image.open(GACHA_PATH / 'UI_Gacha_AvatarIcon_{}.png'.format(raw_data['avatarEnName'])) #角色图像
|
||||
char_img = Image.open(GACHA_PATH / 'UI_Gacha_AvatarImg_{}.png'.format(raw_data['avatarEnName'])) #角色图像
|
||||
|
||||
# 确定图片的长宽
|
||||
w, h = char_img.size
|
||||
if (w, h) != (320, 1024):
|
||||
based_scale = '%.3f' % (based_w / based_h)
|
||||
if (w, h) != (based_w, based_h):
|
||||
offset = 200
|
||||
based_new_w, based_new_h = based_w + offset, based_h + offset
|
||||
based_scale = '%.3f' % (based_new_w / based_new_h)
|
||||
scale_f = '%.3f' % (w / h)
|
||||
new_w = math.ceil(based_h * float(scale_f))
|
||||
new_h = math.ceil(based_w / float(scale_f))
|
||||
new_w = math.ceil(based_new_h * float(scale_f))
|
||||
new_h = math.ceil(based_new_w / float(scale_f))
|
||||
if scale_f > based_scale:
|
||||
bg_img2 = char_img.resize((new_w, based_h), Image.Resampling.LANCZOS)
|
||||
char_img = bg_img2.crop((new_w/2 - 160, 0, new_w/2 + 160, based_h))
|
||||
bg_img2 = char_img.resize((new_w, based_new_h), Image.Resampling.LANCZOS)
|
||||
char_img = bg_img2.crop((new_w/2 - based_new_w /2 + offset, 0, new_w/2 + based_new_w /2 , based_new_h - offset))
|
||||
else:
|
||||
bg_img2 = char_img.resize((based_w, new_h), Image.Resampling.LANCZOS)
|
||||
char_img = bg_img2.crop((0, new_h/2 - 512, based_w, new_h/2 + 512))
|
||||
bg_img2 = char_img.resize((based_new_w , new_h), Image.Resampling.LANCZOS)
|
||||
char_img = bg_img2.crop((0 + offset , new_h/2 - based_new_h/2, based_new_w , new_h/2 + based_new_h/2 - offset))
|
||||
else:
|
||||
pass
|
||||
|
||||
img_temp = Image.new('RGBA', (320, 1024), (0,0,0,0))
|
||||
img_temp = Image.new('RGBA', (based_w, based_h), (0,0,0,0))
|
||||
img_temp.paste(char_img,(0,0),char_imfo_mask)
|
||||
img.paste(img_temp, (41, 29), img_temp)
|
||||
img.paste(img_temp, (0, 0), img_temp)
|
||||
img.paste(char_info_1, (0, 0), char_info_1)
|
||||
|
||||
#holo_img = Image.open(TEXT_PATH / 'icon_holo.png')
|
||||
|
Before Width: | Height: | Size: 434 KiB |
Before Width: | Height: | Size: 399 KiB |
Before Width: | Height: | Size: 374 KiB |
Before Width: | Height: | Size: 390 KiB |
Before Width: | Height: | Size: 390 KiB |
Before Width: | Height: | Size: 519 KiB |
Before Width: | Height: | Size: 537 KiB |
Before Width: | Height: | Size: 423 KiB |
Before Width: | Height: | Size: 488 KiB |
Before Width: | Height: | Size: 419 KiB |
Before Width: | Height: | Size: 439 KiB |
Before Width: | Height: | Size: 473 KiB |
Before Width: | Height: | Size: 374 KiB |
Before Width: | Height: | Size: 556 KiB |
Before Width: | Height: | Size: 410 KiB |
Before Width: | Height: | Size: 451 KiB |
Before Width: | Height: | Size: 401 KiB |
Before Width: | Height: | Size: 410 KiB |
Before Width: | Height: | Size: 366 KiB |
Before Width: | Height: | Size: 551 KiB |
Before Width: | Height: | Size: 423 KiB |
Before Width: | Height: | Size: 433 KiB |
Before Width: | Height: | Size: 493 KiB |
Before Width: | Height: | Size: 418 KiB |
Before Width: | Height: | Size: 462 KiB |
Before Width: | Height: | Size: 432 KiB |
Before Width: | Height: | Size: 550 KiB |
Before Width: | Height: | Size: 562 KiB |
Before Width: | Height: | Size: 562 KiB |
Before Width: | Height: | Size: 379 KiB |
Before Width: | Height: | Size: 399 KiB |
Before Width: | Height: | Size: 448 KiB |
Before Width: | Height: | Size: 451 KiB |
Before Width: | Height: | Size: 451 KiB |
Before Width: | Height: | Size: 498 KiB |
Before Width: | Height: | Size: 560 KiB |
Before Width: | Height: | Size: 515 KiB |
Before Width: | Height: | Size: 508 KiB |
Before Width: | Height: | Size: 508 KiB |
Before Width: | Height: | Size: 451 KiB |
Before Width: | Height: | Size: 338 KiB |
Before Width: | Height: | Size: 549 KiB |
Before Width: | Height: | Size: 444 KiB |
Before Width: | Height: | Size: 575 KiB |
Before Width: | Height: | Size: 423 KiB |
Before Width: | Height: | Size: 475 KiB |
Before Width: | Height: | Size: 384 KiB |
Before Width: | Height: | Size: 473 KiB |
Before Width: | Height: | Size: 324 KiB |
Before Width: | Height: | Size: 441 KiB |
Before Width: | Height: | Size: 320 KiB |
Before Width: | Height: | Size: 434 KiB |
Before Width: | Height: | Size: 556 KiB |
Before Width: | Height: | Size: 499 KiB |
Before Width: | Height: | Size: 555 KiB |
Before Width: | Height: | Size: 529 KiB |
Before Width: | Height: | Size: 496 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Albedo.png
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Aloy.png
Normal file
After Width: | Height: | Size: 772 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Ambor.png
Normal file
After Width: | Height: | Size: 595 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Ambor_TT.png
Normal file
After Width: | Height: | Size: 609 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Ayaka.png
Normal file
After Width: | Height: | Size: 1.7 MiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Ayato.png
Normal file
After Width: | Height: | Size: 1.1 MiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Barbara.png
Normal file
After Width: | Height: | Size: 635 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Beidou.png
Normal file
After Width: | Height: | Size: 1.1 MiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Bennett.png
Normal file
After Width: | Height: | Size: 892 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Chongyun.png
Normal file
After Width: | Height: | Size: 935 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Diluc.png
Normal file
After Width: | Height: | Size: 1.5 MiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Diona.png
Normal file
After Width: | Height: | Size: 440 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Eula.png
Normal file
After Width: | Height: | Size: 1.1 MiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Feiyan.png
Normal file
After Width: | Height: | Size: 858 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Fischl.png
Normal file
After Width: | Height: | Size: 694 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Ganyu.png
Normal file
After Width: | Height: | Size: 1.0 MiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Gorou.png
Normal file
After Width: | Height: | Size: 642 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Hutao.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Itto.png
Normal file
After Width: | Height: | Size: 1.1 MiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Kaeya.png
Normal file
After Width: | Height: | Size: 590 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Kazuha.png
Normal file
After Width: | Height: | Size: 759 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Keqing.png
Normal file
After Width: | Height: | Size: 1.0 MiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Klee.png
Normal file
After Width: | Height: | Size: 486 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Kokomi.png
Normal file
After Width: | Height: | Size: 964 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Lisa.png
Normal file
After Width: | Height: | Size: 495 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Mona.png
Normal file
After Width: | Height: | Size: 1.8 MiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Mona_TT.png
Normal file
After Width: | Height: | Size: 1.8 MiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Ningguang.png
Normal file
After Width: | Height: | Size: 902 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Noel.png
Normal file
After Width: | Height: | Size: 636 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Qin.png
Normal file
After Width: | Height: | Size: 974 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Qin_TT.png
Normal file
After Width: | Height: | Size: 979 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Qiqi.png
Normal file
After Width: | Height: | Size: 1.1 MiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Razor.png
Normal file
After Width: | Height: | Size: 949 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Rosaria #2526820.png
Normal file
After Width: | Height: | Size: 749 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Rosaria.png
Normal file
After Width: | Height: | Size: 795 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Rosaria_TT.png
Normal file
After Width: | Height: | Size: 807 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Sara.png
Normal file
After Width: | Height: | Size: 574 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Sayu.png
Normal file
After Width: | Height: | Size: 613 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Shenhe.png
Normal file
After Width: | Height: | Size: 1.1 MiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Shinobu.png
Normal file
After Width: | Height: | Size: 462 KiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Shougun.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
BIN
enkaToData/gachaImg/UI_Gacha_AvatarImg_Sucrose.png
Normal file
After Width: | Height: | Size: 693 KiB |