473,378 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

PIL problem: IOError: cannot identify image file

Hi,

I installed the newest available PIL (1.1.5 for Python 2.4) from their
site, but cannot seem to open any files. The following

from PIL import Image

i = Image.open(file('c:\\image2.png'))

results in

File "C:\Program Files\Python24\lib\site-packages\PIL\Image.py", line
1745, in open
raise IOError("cannot identify image file")
IOError: cannot identify image file

for any graphics file I've tried. Anyone know what's wrong?

Aug 20 '06 #1
2 22856
Doh! Apparently Image.open() wants a path, not a file. So

i = Image.open('c:\\image2.png')

works fine.

Aug 20 '06 #2
h1*****@gmail.com wrote:
Doh! Apparently Image.open() wants a path, not a file. So

i = Image.open('c:\\image2.png')

works fine.
it works fine on files too, if you open them in *binary* mode.

</F>

Aug 20 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Roger Withnell | last post by:
I would like to check that an image file, selected by a user using fileUpload, is within certain parameters (width, height, filesize) and to display the image file so that the user can see the...
3
by: Scott | last post by:
Hello, I am running into a problem with my code and can't seem to figure out the solution. I know it has to do with the pciture box control and unloading the image inthe picture box but I can't...
3
by: thebhone | last post by:
I am creating a website updater program. Currently working on the image replacement module here. For some reason, after an image (say /images/1.jpg) has been used/opened in the application. I...
1
by: Daniel Mark | last post by:
Hello all: I have following code that works well under command line, but it doesn't work after I convert it as exe application. ############### file: testPath.py import getopt, math, sys,...
12
by: =?iso-8859-1?B?QW5kcuk=?= | last post by:
Other than installing PIL, is there a "simple" way using Python only to determine if a file is a valid image file? I'd be happy if I could at least identify valid images files for gif, jpeg and...
0
by: fatality123 | last post by:
hi all I am new to both python and image processing. My task is to use python and tk to create a tool which can convert between the difft RGb color spaces like 565,888,444 etc and difft YCbCr color...
1
by: Sinan Alkan | last post by:
Hi All, I have a method to resize any image file to the specific dimensions and save this new image to a path. I found it on a web page(By Joel Neubeck) and i changed it for my project. The...
0
by: newsco | last post by:
Dear all, I use VB6 ADO connect to Access 2007 accdb database, everything is fine except I cannot retrieve image file stored in the Access 2007 attachment data type. Can anyone show me some vb...
6
by: vertigo262 | last post by:
I don't know why this does this on the delete. any ideas? line 289 --------------------------------------------- The process cannot access the file...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.