I am running a program where i am showing a .gif image in a widget and it works perfectly well however when i run this app using kivy launcher the .gif image comes with a square box even when the Image is without a backgrund .
Any one any ideas , why this is behaving differently on android and windows .
Please see below .kv code as an example of how i used .gif image . I am using this .gif image as a button .
<ButImage@ButtonBehavior+AsyncImage> canvas.before: Color: rgb: (0, 0, 1) PushMatrix Rotate: axis: 0,0,1 angle: 20 origin: self.center source: "images/butterflybluex.gif" canvas.after: PopMatrix
<img alt="Attached GIF" class="b-lazy" data-src="https://i.stack.imgur.com/zpo0D.gif" data-original="https://i.stack.imgur.com/zpo0D.gif" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />Answer1:
First make sure that you package pil/pillow [just add it to one of the requirements while building the apk] for gif loading, otherwise a pure python loader that is very slow for android would be used, Second please elaborate what you mean by the square box?
Update: your updated example shows that you are using AsyncImage with a local source, Async Image is ment to be used with a remote url for local sources you can just use a
Second: If you are getting a white background instead of a image you gave it the wrong path. Make sure your image is present in the directory or that your directory is present in the right place on the launcher.
Update 3: The issue as stated earlier is with gif image loader using pil. Not all images work with it. It works on your desktop cause pil isn't installed and a pure python gif loader is used instead. This loader would not be usable on android cause of speed issues.
One workaround is to use gimp to open and save the image. It should work properly then. One other way is to contribute and fix: the loader using pil for gif...(I must warn there are so many different gifs on web each with their own slightly changes. Making sure one works would lead to others getting broken.)
To reproduce your issue on desktop just install pillow.
There are many artifacts that can come up while using gifs for animation, I'd recommend you use images(png/jpg...) in a
.zip and set that to the source. That way you get rid of the artifacts.
Please make sure that gif or .zip animation provided by the Image class, is only used for situations where you don't need to control the animation a lot. Like for static animations that don't change.
If your animations needs go beyond this then you should manage your animation manually by loading a sprite sheet in a Atlas.