54310

.gif Image as source runs nicely in Windows kivy program . Running via kivy Launcher shows backgroun

Question:

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 Image class.

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.

Recommend

  • Walk along PShape contours and divide them?
  • Google Street View container inside Shiny Application
  • winrt, javascript, image from byte array
  • IndexSizeError on drawImage on IE and Edge
  • Passing an array from class A to class B
  • problem with code to combine two images in android?
  • How to make image control button for each image inside the div using css and js?
  • resize image using tkinter
  • Why does this use of getImageData leak memory
  • Accessing Windows Azure Queues from client side javascript/jquery
  • Differences between drawing an Ellipse in Android and Java
  • Remove previous Directions Route Google Maps
  • write text on image and show it to a imageview
  • JSON - slashes not escaping
  • Google Maps api v3 get start and end coordinates of a street
  • How to draw a line dynamically in android [duplicate]
  • Plotting densities in R
  • Update Google Maps traffic layer without page reloading
  • where do I find the xml.dom python package for the python-2.6.0-8.9.28 and I have a suse/x86_64 vers
  • Spring boot 2.0.0.M4 required a bean named 'entityManagerFactory' that could not be found
  • Java color detection
  • Read text file that is not in the main package in a runnable jar
  • Roxygen error “Skipping invalid path”
  • Chart.js Multiple dataset
  • Installing iPhone App to iPhone
  • HTTP/2 streams vs HTTP/1.1 connections
  • Syntax for setting draggablecursor property in google maps api
  • Algorithm for a smudge tool?
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Counter field in MS Access, how to generate?
  • How to apply VCL Styles to DLL-based forms in Inno Setup?
  • Javascript + PHP Encryption with pidCrypt
  • Websockets service method fails during R startup
  • GridView Sorting works once only
  • How to get icons for entities from eclipse?
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • JTable with a ScrollPane misbehaving
  • Android Google Maps API OnLocationChanged only called once
  • Android Heatmap on canvas or ImageView
  • git trying to push non-existent file … after clearing cache