mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2025-04-12 23:29:37 +08:00
fix bug
This commit is contained in:
parent
ef00094b8f
commit
20e9b3659e
@ -28,6 +28,7 @@ class MessageBuild:
|
|||||||
if isinstance(img, str) or isinstance(img, Path):
|
if isinstance(img, str) or isinstance(img, Path):
|
||||||
img = load_image(path=img, size=size, mode=mode, crop=crop)
|
img = load_image(path=img, size=size, mode=mode, crop=crop)
|
||||||
bio = BytesIO()
|
bio = BytesIO()
|
||||||
|
img = img.convert(mode)
|
||||||
img.save(bio, format='JPEG' if mode == 'RGB' else 'PNG', quality=quality)
|
img.save(bio, format='JPEG' if mode == 'RGB' else 'PNG', quality=quality)
|
||||||
img_b64 = 'base64://' + base64.b64encode(bio.getvalue()).decode()
|
img_b64 = 'base64://' + base64.b64encode(bio.getvalue()).decode()
|
||||||
return MessageSegment.image(img_b64)
|
return MessageSegment.image(img_b64)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user