.gif图像源在Windows kivy程序更好地运行。通过kivy启动运行显示gif图片的背景 [英] .gif Image as source runs nicely in Windows kivy program . Running via kivy Launcher shows background of gif image

查看:1861
本文介绍了.gif图像源在Windows kivy程序更好地运行。通过kivy启动运行显示gif图片的背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行一个程序,我显示在小部件.gif图像,它工作得很好但是当我使用kivy发射的.gif图像带有一个方盒子运行这个程序,即使图像是一个没有backgrund 。

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 .

任何一个任何想法,为什么这是不同的行为在Android和Windows。

Any one any ideas , why this is behaving differently on android and windows .

请参见下面.kv code作为我如何使用的.gif图像的例子。我用这.gif图像作为按钮。

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

...

推荐答案

首先确保您打包PIL /抱枕[只需将其添加到在构建APK的要求之一]为GIF加载,否则纯Python加载器Android游戏很慢的会被使用,其次请详细说明您的方盒子是什么意思?

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?

更新:更新后的例子表明,你正在使用AsyncImage与本地源,异步图像是彪与您可以只使用一个图片类。

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.

第二:如果你得到一个白色的背景,而不是像你给它在错误的道路。确保你的图片是在目录或目录是在发射正确的地方present present。

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.

更新3:如前所述的问题是使用PIL GIF图像加载器。并非所有的图像使用它。它可以在你的桌面原因PIL未安装和纯Python GIF加载器来代替。该装载机将不会对速度问题的android事业使用。

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.

一个解决方法是使用GIMP打开和保存图像。它应该正常工作即可。
另一种方式是促进和修复:使用PIL为GIF装载机...(我必须提醒有网络上这么多不同的GIF每个都有自己的略有变化,确保一件作品,会导致人越来越破。)

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.

有能够拿出在使用的GIF动画许多文物,我建议你在使用图片(PNG / JPG ...)一个 .zip文件和设置到源。你摆脱文物的方式。

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.

请确保GIF或由Image类提供的.zip文件的动画,只用于在您不需要控制动画很多的情况。像静态动画不改变

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.

这篇关于.gif图像源在Windows kivy程序更好地运行。通过kivy启动运行显示gif图片的背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆