469,270 Members | 1,172 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

Unable to get PIL to load jpeg images

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

Feb 6 '06 #1
9 3328
Someone out there must surely know - please!

Peter

Feb 7 '06 #2
pe**********@talk21.com wrote:
Someone out there must surely know - please!

Peter

Try im*******@python.org - 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
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Feb 7 '06 #3
On 2/7/06, Steve Holden <st***@holdenweb.com> wrote:
pe**********@talk21.com wrote:
Someone out there must surely know - please!

Peter


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.

--
Andrew Gwozdziewycz <ap****@gmail.com>
http://ihadagreatview.org
http://plasticandroid.org
Feb 8 '06 #4
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
On 2/9/06, Andrew Gwozdziewycz <ap****@gmail.com> wrote:
On 2/7/06, Steve Holden <st***@holdenweb.com> wrote:
pe**********@talk21.com wrote:
Someone out there must surely know - please!

Peter


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.

--
Andrew Gwozdziewycz <ap****@gmail.com>
http://ihadagreatview.org
http://plasticandroid.org
--
http://mail.python.org/mailman/listinfo/python-list

--
----
Amit Khemka -- onyomo.com
Endless the world's turn, endless the sun's Spinning, Endless the quest;
I turn again, back to my own beginning, And here, find rest.
Feb 9 '06 #5

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

Feb 9 '06 #6
pe**********@talk21.com wrote:
.... 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
sc***********@acm.org
Feb 9 '06 #7
gr
Peter,

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

thx,

gerry rodman
http://www.gerryrodman.com/
pe**********@talk21.com wrote:
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


Feb 15 '06 #8
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/

Feb 15 '06 #9
> 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

Feb 16 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Derek | last post: by
3 posts views Thread by markus | last post: by
4 posts views Thread by Rednelle | last post: by
4 posts views Thread by jordi_ramis | last post: by
3 posts views Thread by Michael martin | last post: by
3 posts views Thread by den 2005 | last post: by
4 posts views Thread by Aquosus | last post: by
1 post views Thread by Masood | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.