kivy/examples/miscellaneous/imagesave.py

15 lines
294 B
Python
Raw Normal View History

2019-02-01 19:21:09 +00:00
# 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")
2019-02-01 19:51:08 +00:00
print("len=", len(bio.read()))