🐛 修复请求BUG

This commit is contained in:
Wuyi无疑 2023-07-17 02:51:47 +08:00
parent 3498055c36
commit 801ece12dd
2 changed files with 3 additions and 3 deletions

View File

@ -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(

View File

@ -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()