使用命令im.show() 有開啟影像瀏覽但無法正常顯示照片,且檔名不是目標檔,而是xxx.BMP.

但是print(im)指令有正常顯示圖片資訊,所以表示有正常讀取到目標.

 

解決方式是需修改ImageShow.py

Edit C:\Python26\lib\site-packages\PIL\ImageShow.py, and around line 99, replace with the following line:
return "start /wait %s && PING 127.0.0.1 -n 5 > NUL && del /f %s" % (file, file)

修改前為

 return "start /wait %s && del /f %s" % (file, file)

修改後為

return "start /wait %s && PING 127.0.0.1 -n 5 > NUL && del /f %s" % (file, file)

然後就可正常顯示圖片,但是檔名仍不是原本目標檔名.

其說明為原始圖片會存放於暫存檔BMP, 待執行完成後暫存檔會被刪除,結果導致無法正常顯示圖片.

arrow
arrow
    全站熱搜

    門外漢 發表在 痞客邦 留言(0) 人氣()