Unable to get PIL to load jpeg images

Discussion in 'Python' started by peter.mosley@talk21.com, Feb 6, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertising

  2. Guest

    Someone out there must surely know - please!

    Peter
     
    , Feb 7, 2006
    #2
    1. Advertising

  3. Steve Holden Guest

    wrote:
    > Someone out there must surely know - please!
    >
    > Peter
    >

    Try - 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/
     
    Steve Holden, Feb 7, 2006
    #3
  4. On 2/7/06, Steve Holden <> wrote:
    > 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 <>
    http://ihadagreatview.org
    http://plasticandroid.org
     
    Andrew Gwozdziewycz, Feb 8, 2006
    #4
  5. Amit Khemka Guest

    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 <> wrote:
    > On 2/7/06, Steve Holden <> wrote:
    > > 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 <>
    > 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.
     
    Amit Khemka, Feb 9, 2006
    #5
  6. Guest

    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, 2006
    #6
  7. 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
     
    Scott David Daniels, Feb 9, 2006
    #7
  8. gr Guest

    Peter,

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

    thx,

    gerry rodman
    http://www.gerryrodman.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
     
    gr, Feb 15, 2006
    #8
  9. gr Guest

    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/
     
    gr, Feb 15, 2006
    #9
  10. Guest

    > 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, 2006
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eugene Morozov

    JPEG comments and PIL

    Eugene Morozov, Sep 11, 2003, in forum: Python
    Replies:
    1
    Views:
    387
    Fredrik Lundh
    Sep 13, 2003
  2. Gerrit Holl

    PIL: jpeg comment

    Gerrit Holl, Dec 23, 2003, in forum: Python
    Replies:
    1
    Views:
    376
    John P. Speno
    Dec 29, 2003
  3. Jeff Kunce

    RE: [Image-SIG] PIL: jpeg comment

    Jeff Kunce, Jan 2, 2004, in forum: Python
    Replies:
    0
    Views:
    455
    Jeff Kunce
    Jan 2, 2004
  4. lovaspillando
    Replies:
    0
    Views:
    1,064
    lovaspillando
    Aug 26, 2007
  5. Ivan Alameda Carballo
    Replies:
    0
    Views:
    510
    Ivan Alameda Carballo
    Aug 26, 2007
Loading...

Share This Page