test-kivy-app/kivy_venv/share/kivy-examples/miscellaneous/imagesave.py
2024-09-15 15:12:16 +03:00

15 lines
308 B
Python

# save an image into bytesio
from kivy.core.image import Image
from io import BytesIO
img = Image.load("data/logo/kivy-icon-512.png")
bio = BytesIO()
ret = img.save(bio, fmt="png")
print("len=", len(bio.read()))
bio = BytesIO()
ret = img.save(bio, fmt="jpg")
print("len=", len(bio.read()))