Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Unable to get PIL to load jpeg images

Reply
Thread Tools

Unable to get PIL to load jpeg images

 
 
peter.mosley@talk21.com
Guest
Posts: n/a
 
      02-06-2006
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

 
Reply With Quote
 
 
 
 
peter.mosley@talk21.com
Guest
Posts: n/a
 
      02-07-2006
Someone out there must surely know - please!

Peter

 
Reply With Quote
 
 
 
 
Steve Holden
Guest
Posts: n/a
 
      02-07-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Someone out there must surely know - please!
>
> Peter
>

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

 
Reply With Quote
 
Andrew Gwozdziewycz
Guest
Posts: n/a
 
      02-08-2006
On 2/7/06, Steve Holden <(E-Mail Removed)> wrote:
> (E-Mail Removed) 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 <(E-Mail Removed)>
http://ihadagreatview.org
http://plasticandroid.org
 
Reply With Quote
 
Amit Khemka
Guest
Posts: n/a
 
      02-09-2006
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 <(E-Mail Removed)> wrote:
> On 2/7/06, Steve Holden <(E-Mail Removed)> wrote:
> > (E-Mail Removed) 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 <(E-Mail Removed)>
> 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.
 
Reply With Quote
 
peter.mosley@talk21.com
Guest
Posts: n/a
 
      02-09-2006

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

 
Reply With Quote
 
Scott David Daniels
Guest
Posts: n/a
 
      02-09-2006
(E-Mail Removed) 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
(E-Mail Removed)
 
Reply With Quote
 
gr
Guest
Posts: n/a
 
      02-15-2006
Peter,

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

thx,

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


(E-Mail Removed) 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


 
Reply With Quote
 
gr
Guest
Posts: n/a
 
      02-15-2006
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/

 
Reply With Quote
 
peter.mosley@talk21.com
Guest
Posts: n/a
 
      02-16-2006
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PIL: problem to convert an image array to PIL format Sverre Python 2 12-17-2009 04:33 PM
[PIL] is there a downloadable docs for PIL Egor Bolonev Python 2 12-24-2004 11:05 AM
RE: [Image-SIG] PIL: jpeg comment Jeff Kunce Python 0 01-02-2004 04:20 AM
PIL: jpeg comment Gerrit Holl Python 1 12-29-2003 09:33 PM
JPEG comments and PIL Eugene Morozov Python 1 09-13-2003 08:55 AM



Advertisments