xp下使用pil提供的show无法打开图片

来源:互联网 发布:中国观鸟网络 编辑:程序博客网 时间:2024/06/06 01:36

pil用的是Pillow-2.3.0.win32-py2.7.exe版本

python 2.7.5

调用show是老是出现windows无法打开temp文件夹中的bmp图片。

修改了PIL中ImageShow.py中的如下代码就可以了。

if sys.platform == "win32":


    class WindowsViewer(Viewer):
        format = "BMP"
        def get_command(self, file, **options):
            #return ("start /wait %s && ping -n 2 127.0.0.1 >NUL "
                    #"&& del /wait /f %s" % (quote(file), quote(file)))
            return "start /wait %s && del /f %s" % (file,file)
    register(WindowsViewer)
0 0
原创粉丝点击