mirror of
https://github.com/Xtao-Labs/misskey2telegram.git
synced 2024-11-25 14:55:19 +00:00
13 lines
288 B
Python
13 lines
288 B
Python
from io import BytesIO
|
|
from PIL import Image
|
|
|
|
|
|
def webp_to_jpg(content: bytes) -> BytesIO:
|
|
"""Convert a WebP image to a JPEG image."""
|
|
im = Image.open(BytesIO(content))
|
|
jpg = BytesIO()
|
|
rgb_im = im.convert("RGB")
|
|
rgb_im.save(jpg, "JPEG")
|
|
jpg.seek(0)
|
|
return jpg
|