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