Upload image from memory to Kivy

I have an image in format memory (output from pyplot) and I want to directly show it on Android through Kivy, but I do not want to create an image file. Is there any way to do this? On pyplot, I can generate the file as an object by writing it as an object, but I don't know how to put it in Kivy.

+3
source share
1 answer

You can save the file to the buffer using StringIO (see the following: binary buffer in Python ).

Sort of:

from StringIO import StringIO
buff = StringIO()
plt.savefig(buff)
buff.seek(0)
from kivy.core.image.img_pygame import ImageLoaderPygame
imgdata = ImageLoaderPygame(buff)._data
+2
source

All Articles