diff --git a/gsuid_core/utils/api/ambr/request.py b/gsuid_core/utils/api/ambr/request.py index 6bd1330..6991437 100644 --- a/gsuid_core/utils/api/ambr/request.py +++ b/gsuid_core/utils/api/ambr/request.py @@ -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' if file_path.exists(): - async with aiofiles.open(path, 'rb') as f: - return Image.open(await f.read()) + async with aiofiles.open(file_path, 'rb') as f: + return Image.open(BytesIO(await f.read())) async with AsyncClient(timeout=None) as client: req = await client.get( diff --git a/gsuid_core/utils/image/convert.py b/gsuid_core/utils/image/convert.py index a075433..c70022a 100644 --- a/gsuid_core/utils/image/convert.py +++ b/gsuid_core/utils/image/convert.py @@ -45,7 +45,7 @@ async def convert_img( if isinstance(img, Image.Image): img = img.convert('RGB') 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() if is_base64: res = 'base64://' + b64encode(res).decode()