Closed Sclock closed 2 years ago
已经修改
真的吗,刚刚测试还是不行
是哪个指令, wiki的我改了
定位在钟离命之座的 3,5 的图标
https://upload-bbs.mihoyo.com/game_record/genshin/constellation_icon/UI_Talent_U_Zhongli_01.png
https://upload-bbs.mihoyo.com/game_record/genshin/constellation_icon/UI_Talent_U_Zhongli_02.png
在
draw_role_card
方法内 await aiorequests.get_img
获取之后 mode 为p ,无法与 mode 为 RGBA 的底图叠加。
调试信息: ··· name UI_Talent_S_Zhongli_01 url https://upload-bbs.mihoyo.com/game_record/genshin/constellation_icon/UI_Talent_S_Zhongli_01.png talent_icon (45, 45) bg (1080, 1920) (529, 813) talent_icon: <PIL.Image.Image image mode=RGBA size=45x45 at 0x19425C4D720> bg: <PIL.Image.Image image mode=RGBA size=1080x1920 at 0x19425AC3340>
name UI_Talent_S_Zhongli_02 url https://upload-bbs.mihoyo.com/game_record/genshin/constellation_icon/UI_Talent_S_Zhongli_02.png talent_icon (45, 45) bg (1080, 1920) (613, 813) talent_icon: <PIL.Image.Image image mode=RGBA size=45x45 at 0x19425C4D720> bg: <PIL.Image.Image image mode=RGBA size=1080x1920 at 0x19425AC3340>
name UI_Talent_U_Zhongli_01 url https://upload-bbs.mihoyo.com/game_record/genshin/constellation_icon/UI_Talent_U_Zhongli_01.png talent_icon (45, 45) bg (1080, 1920) (697, 813) talent_icon: <PIL.Image.Image image mode=P size=45x45 at 0x19425C4D720> bg: <PIL.Image.Image image mode=RGBA size=1080x1920 at 0x19425AC3340>
name UI_Talent_S_Zhongli_03 url https://upload-bbs.mihoyo.com/game_record/genshin/constellation_icon/UI_Talent_S_Zhongli_03.png talent_icon (45, 45) bg (1080, 1920) (781, 813) talent_icon: <PIL.Image.Image image mode=RGBA size=45x45 at 0x19425C4D720> bg: <PIL.Image.Image image mode=RGBA size=1080x1920 at 0x19425AC3340>
name UI_Talent_U_Zhongli_02 url https://upload-bbs.mihoyo.com/game_record/genshin/constellation_icon/UI_Talent_U_Zhongli_02.png talent_icon (45, 45) bg (1080, 1920) (865, 813) talent_icon: <PIL.Image.Image image mode=P size=45x45 at 0x19425C4D720> bg: <PIL.Image.Image image mode=RGBA size=1080x1920 at 0x19425AC3340>
name UI_Talent_S_Zhongli_04 url https://upload-bbs.mihoyo.com/game_record/genshin/constellation_icon/UI_Talent_S_Zhongli_04.png talent_icon (45, 45) bg (1080, 1920) (949, 813) talent_icon: <PIL.Image.Image image mode=RGBA size=45x45 at 0x19425C4D720> bg: <PIL.Image.Image image mode=RGBA size=1080x1920 at 0x19425AC3340> ···
我刚刚试了把这俩图片删了,再用ysd
,能正常下载图片,draw_role_card.py
文件的第116和117行
116 talent_icon = await aiorequests.get_img(url=talent_url.format(talent["图标"]), size=(45, 45),
117 save_path=talent_icon, mode='RGBA')
已经强制对下载的图片进行RGBA转换了
get_img 有时获取的图片 mode=P ,在进行
alpha_composite
时会报ValueError: images do not match
经测试可能是链接的问题,问题链接示例:
修复方法
强制转换所有获取的图片
或者直接打包一个 get_img_rgba 方法,自动修改图片格式