|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Image class not finding image on a website
I'm trying a simple image initialization... but alas alack and stuff...
Code:
'''imports''' ##! /usr/local/bin/python import sys, Image, urllib image = 'http://www.footymania.com/images/banners/bannerdan.png' im = Image.open(image) I get the following error message File (location of file\Image.py), Line 1543, in open fp = __builtin__.open(fp, "rb") IOError: [Errno 2] No such file or directory: 'http://www.footymania.com/images/banners/bannerdan.png' This happens for all types of images online even though i know they exist. I tested it out with the google logos as well, and the same error takes place. |
|
#2
|
||||
|
||||
|
The problem your getting is that your trying to pass a URL to Image.open when it wants a local path.
If you really want to load an image from online then you will probably need to use urllib.urlopen() to get the image as a string (or write it to a file) and then load the image into PIL from the string (or file). Hope this helps clear things up, Mark. |
|
#3
|
|||
|
|||
|
AAaaaaaaaah... makes sense.. bummer though, cause I know you can do that with the php image library.
|
|
#4
|
||||
|
||||
|
Ah but then PHP was designed spacifically for the web so it makes sence that you can use URL's as paths in some functions
where Pythons design is alot more general perpose yet infinatly nicer IMO.Mark. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Image class not finding image on a website |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|