problem
I am able to load pictures with the Image() module in kivy. But for some reason, I can't load .tif files into kivy. When the image source is '..\pics\lugia.png', the image loads perfectly fine. But if the source is '..\pics\snorlax.tif', I just get that white box and the error:
[WARNING] [Image ] Unable to load image <C:\Users\path\pics\snorlax.tif>
[ERROR ] [Image ] Error loading texture ..\pics\snorlax.tif
code
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.clock import Clock
from kivy.uix.image import Image
class ContainerBox(BoxLayout):
def __init__(self, **kwargs):
super(ContainerBox, self).__init__(**kwargs)
self.orientation = 'vertical'
#self.picture = Image(allow_stretch=True, source='..\pics\lugia.png')
self.picture = Image(allow_stretch=True, source='..\pics\snorlax.tif')
Clock.schedule_once(lambda dt: self.add_widget(self.picture), timeout=0.1)
class SimpleImage(App):
def build(self):
return ContainerBox()
if __name__ == '__main__':
SimpleImage().run()
technical details
my question to you
Am I doing something wrong, or does Kivy just not support TIFF format?
You need to create a proper installation
I used anaconda to install kivy and I wasn't very thorough with installing the dependencies properly. So I had to create a fresh virtual python installation.
Note: This is for python version 3.5 or higher. Also I am going to have you explicitly state what python installation is going to be creating this environment. To my knowledge, there's no good reason to do this.
Windows
pythonimport sys, osos.path.dirname(sys.executable)C:\Users\H\AppData\Local\Programs\Python\Python36\python -m venv C:\Users\H\venvs\env1python -m venv C:\Users\H\venvs\env1C:\Users\H\venvs\env1\Scripts\activatepython -m pip install docutils pygments pypiwin32 kivy_deps.sdl2==0.1.22 kivy_deps.glew==0.1.12python -m pip install kivy==1.11.1If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With