Unable to get PIL to load jpeg images

P

peter.mosley

Hello again

I'm still wrestling with Python / Tkinter / PIL. I have almost got it
to work - on a Fedora Core 1 system I can now display images in a
Tkinter window. But I also run a Fedora Core 3 system, and when I
tried the same procedures I get the following errors:-

[kpeter@localhost jpgTest]$ python pil_jpg.py
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 1345, in __call__
return self.func(*args)
File "pil_jpg.py", line 26, in do_something
a.thumbnail((200,150))
File "/usr/lib/python2.3/site-packages/PIL/Image.py", line 1422, in
thumbnail
self.load()
File "/usr/lib/python2.3/site-packages/PIL/ImageFile.py", line 180,
in load
d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
File "/usr/lib/python2.3/site-packages/PIL/Image.py", line 328, in
_getdecoder
raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available

I am running Python 2.3.4, PIL 1.1.5 on a Fedora Core 3 system. I know
the code is ok, as it runs quite happily under FC1 and Windows. I've
searched around for clues, and found a few references to this error
message, but quite frankly don't understand what they are saying.

Searching around for files that look as if they may be the jpeg
libraries I can find
/usr/lib/libjpeg.so.62.0.0, and a symbolic link /usr/lib/libjpeg.so.62.
I think I somehow have to configure PIL to recognise these, but I am
not sure and anyway don't know how to do this.

Can anyone help?

Peter
 
S

Steve Holden

Someone out there must surely know - please!

Peter
Try (e-mail address removed) - or better still, subscribe to the image SIG
mailing list (then you'll see replies ...)

I've never had any problems loading JPEG images. It's probably a setup
issue.

regards
Steve
 
A

Andrew Gwozdziewycz

Try building the PIL from scratch. It might give you some insight as
to which library it exactly is looking for. I can remember when
compiling the PIL on my mac having to create a symbolic link to
libjpeg.so.6 or something. It was bizarre but worked fine afterwards.
 
A

Amit Khemka

This is because PIL, is not able to find the jpeg library .

1. Install jpeg-libs from sources: (http://www.ijg.org/files/jpegsrc.v6b.tar.gz)
2.0: "clean" the PIL build
2.1 In setup.py that comes with PIL, set the JPEG_ROOT to the jpeg-lib path
3.0 run setup.py

I hope that should help ..

cheers,
amit
 
P

peter.mosley

Thanks for that tip

Following a dialogue in that discussion group it is now working. The
problem was that I didn't have the right jpeg library installed
(although what I had was enough to show jpegs in gThumb, GIMP and the
Gnome and KDE desktops so I don't understand why it wasn't). I had to
also install a jpeg development library, which fortunately was
available on my Fedora Core 3 installation disc.

A final glitch was that the previous broken build interfered with the
linking of PIL to the libraries. I went for overkill, and deleted all
the PIL installation and site-packages directories, then reinstalled
from the original tarball. This gave a curious glitch, in that the
first time I ran it it failed to load Tkinter with some obscure error
message, but on a retry everything was fine. This worries me slightly,
as I don't know what happened and there is always a chance it could
happen again, but until it does I can't investigate it.

Slightly off topic, but I think my experience here is typical of any
installation on a Linux system, and illustrates why, despite huge
improvements over the last few years, Linux is not yet really suitable
for non expert use.

Thanks to everyone who's helped me over the last few months.

Peter
 
S

Scott David Daniels

.... The problem was that I didn't have the right jpeg library installed
(although what I had was enough to show jpegs in gThumb, GIMP and the
Gnome and KDE desktops so I don't understand why it wasn't). I had to
also install a jpeg development library, which fortunately was
available on my Fedora Core 3 installation disc....

The problem is in the name chosen by _lots_ of distributions. A "jpeg
developer library" or any other of the "development libraries" are not
just for those who intend to "develop" jpeg, but really for those who
"develop programs" -- that is run compilers and linkers. If you need
to compile and link a program that uses one of these libraries, you need
the "developer library." Even if the only sense in which you are a
developer is that you are rebuilding Fredrik's code.

--Scott David Daniels
(e-mail address removed)
 
G

gr

Found it...and will share.

You need to install the "X Software Developement" library (standard
only is enough) from you Fedora distro...not sure what will be required
on other Linux distro's.

Worked like a charm...thanks Peter.

gerry rodman
http://www.gerryrodman.com/
 
P

peter.mosley

Can you share the name of the library on the Fedora distro?


file:///media/cdrecorder/Fedora/RPMS/libjpeg-devel-6b-33.i386.rpm

On disc 3 in my copy, but that probably doesn't mean anything!

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top