相关疑难解决方法(0)

Windows上的Python成像库show()

我正在编写一个脚本,从Web下载各种图像文件,然后使用PIL对它们进行一些处理.该脚本使用urlretreive将图像转储到临时文件,现在我只是尝试使用PIL image.show()方法在查看器中打开它们.以下是代码的相关部分:

def main():

link_queue = Queue.Queue()
image_queue = Queue.Queue()

links = get_image_links('test_search')

for link in links:
    link_queue.put(link)

for image in xrange(len(links)):
    #create image downloading threads
    t = ImageDownloadingThread(link_queue, image_queue)
    t.setDaemon(True)
    t.start()

link_queue.join()

image_data = image_queue.get()
image_file, image_url = image_data[0][0], image_data[1][0] 
#get the first image downloaded and take a look
image = Image.open(image_file)
image.show()
Run Code Online (Sandbox Code Playgroud)

不幸的是,虽然临时文件似乎加载正常(Image.open没有返回任何错误),但是当调用image.show()时,我在查看器中什么也得不到:

在此输入图像描述

我也尝试打开本地非临时文件,以防出现问题,并获得相同的结果.操作系统是Windows Vista 32位SP2.关于可能出错的任何想法?

python python-imaging-library

7
推荐指数
1
解决办法
7048
查看次数

标签 统计

python ×1

python-imaging-library ×1