REQUIREMENT
I\'m trying to retrieve an image from Database and set this image to kivy image widget, this operation throws a ValueError, unsure of the ca
After execution of io.BytesIO()
, data
is in Bytes. Use Kivy CoreImage and texture
to convert data
.
Replace
self.image.source = data
with:
self.image.texture = CoreImage(data, ext="png").texture
Image source
source
Filename / source of your image.
source is a StringProperty and defaults to None
Ikolim's answer is good but to be more specific, If you want to display a binary image directly into kivy you can simply work with io module (import io) and kivy image module (kivy.uix.image)
Check this code:
from kivy.uix.image import Image, CoreImage
import io
binary_data= #binary img extracted from sqlite
data = io.BytesIO(binary_data)
img=CoreImage(data, ext="png").texture
new_img= Image()
new_img.texture= img