What is the best format to save an image in Python, and why does pydot save invalid images?

后端 未结 1 1479
天命终不由人
天命终不由人 2021-01-25 05:25

I am using pydot to save an image file on my machine and then use the Image module to open the file. However, I get an error using Windows Photo viewer

相关标签:
1条回答
  • 2021-01-25 06:06

    This looks like a known bug in the image viewer of PIL on Windows Vista/7. You can try to fix PIL/ImageShow.py as follows:

    diff -r 142e08f1b589 PIL/ImageShow.py
    --- a/PIL/ImageShow.py  Sun Aug 01 22:00:26 2010 +0200
    +++ b/PIL/ImageShow.py  Wed Jan 05 10:46:47 2011 -0800
    @@ -97,7 +97,7 @@
         class WindowsViewer(Viewer):
             format = "BMP"
             def get_command(self, file, **options):
    -            return "start /wait %s && del /f %s" % (file, file)
    +            return "start /wait %s && ping -n 2 127.0.0.1 >NUL && del /f %s" % (file, file)
    
         register(WindowsViewer)
    
    0 讨论(0)
提交回复
热议问题