mirror of
https://github.com/Genshin-bots/gsuid_core.git
synced 2025-05-12 06:55:49 +08:00
🐛 修复请求BUG
This commit is contained in:
parent
3498055c36
commit
801ece12dd
@ -121,8 +121,8 @@ async def get_ambr_icon(type: str, icon_name: str, path: Path) -> Image.Image:
|
|||||||
file_path = path / f'{icon_name}.png'
|
file_path = path / f'{icon_name}.png'
|
||||||
|
|
||||||
if file_path.exists():
|
if file_path.exists():
|
||||||
async with aiofiles.open(path, 'rb') as f:
|
async with aiofiles.open(file_path, 'rb') as f:
|
||||||
return Image.open(await f.read())
|
return Image.open(BytesIO(await f.read()))
|
||||||
|
|
||||||
async with AsyncClient(timeout=None) as client:
|
async with AsyncClient(timeout=None) as client:
|
||||||
req = await client.get(
|
req = await client.get(
|
||||||
|
@ -45,7 +45,7 @@ async def convert_img(
|
|||||||
if isinstance(img, Image.Image):
|
if isinstance(img, Image.Image):
|
||||||
img = img.convert('RGB')
|
img = img.convert('RGB')
|
||||||
result_buffer = BytesIO()
|
result_buffer = BytesIO()
|
||||||
img.save(result_buffer, format='PNG', quality=80, subsampling=0)
|
img.save(result_buffer, format='JPEG', quality=85)
|
||||||
res = result_buffer.getvalue()
|
res = result_buffer.getvalue()
|
||||||
if is_base64:
|
if is_base64:
|
||||||
res = 'base64://' + b64encode(res).decode()
|
res = 'base64://' + b64encode(res).decode()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user