【发布时间】:2011-09-20 04:39:52
【问题描述】:
我想使用 python 将网页中的 .jsp 图像保存到我的计算机中。
我尝试了很多方法,包括
机械化和检索功能 urllib.urlretrieve('http://example.com/img.jsp', 'img.jsp')
但问题是当我尝试使用图像库打开图像时会引发以下错误
File "code.py", line 71, in extract_image
im = Image.open(image_file)
File "/usr/lib/python2.6/dist-packages/PIL/Image.py", line 1980, in open
raise IOError("cannot identify image file")
我什至尝试将图像保存为 .png 格式,但它不起作用。 但是我可以通过转到图像网址然后保存图像来手动保存。
请帮忙!
【问题讨论】:
-
该文件包含什么?
-
它可以是任何随机图像,甚至是背景图像。
-
你想让我重复我的问题吗?
-
你不是说jpg吗? JSP 不是图像格式。
-
同样使用 python 图像库。
标签: python image jsp image-manipulation mechanize