Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #61107 > unrolled thread

PIL(Pillow) fails with PNG image

Started bytastyminerals <tastyminerals@gmail.com>
First post2013-12-05 23:26 +0300
Last post2013-12-06 07:54 +0100
Articles 3 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  PIL(Pillow) fails with PNG image tastyminerals <tastyminerals@gmail.com> - 2013-12-05 23:26 +0300
    Re: PIL(Pillow) fails with PNG image John Gordon <gordon@panix.com> - 2013-12-06 02:07 +0000
    Re: PIL(Pillow) fails with PNG image Christian Gollwitzer <auriocus@gmx.de> - 2013-12-06 07:54 +0100

#61107 — PIL(Pillow) fails with PNG image

Fromtastyminerals <tastyminerals@gmail.com>
Date2013-12-05 23:26 +0300
SubjectPIL(Pillow) fails with PNG image
Message-ID<mailman.3618.1386290317.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

Hi, I am getting an error when trying to use Pillow library to display 
image PNG  on a Tkinter Button widget. Here is my code.

|image=  Image.open(os.path.join('icons','bulb.png'))  # using PIL for png images
         self.correctGuessImage=  ImageTk.PhotoImage(image)

|>>>
|File  "/home/user/Documents/temp.py",  line222,  in  drawButtons
     self.correctGuessImage=  ImageTk.PhotoImage(image)
   File  "/usr/lib/python2.7/dist-packages/PIL/ImageTk.py",  line121,  in  __init__
     self.paste(image)
   File  "/usr/lib/python2.7/dist-packages/PIL/ImageTk.py",  line171,  in  paste
     im.load()
   File  "/usr/lib/python2.7/dist-packages/PIL/ImageFile.py",  line192,  in  load
     d=  Image._getdecoder(self.mode,  d,  a,  self.decoderconfig)
AttributeError:  'module'  object has no attribute'_getdecoder'|||

While working fine under windows 7x64 it fails to work on Linux Mint 
x64. I am getting this error running the same file. I installed 
everything I could find with 'python','png' and 'tk' from the reps but 
no effect. Any ideas why is this happening and how to fix this?

Pavel

[toc] | [next] | [standalone]


#61109

FromJohn Gordon <gordon@panix.com>
Date2013-12-06 02:07 +0000
Message-ID<l7rbg9$paj$1@reader1.panix.com>
In reply to#61107
In <mailman.3618.1386290317.18130.python-list@python.org> tastyminerals <tastyminerals@gmail.com> writes:

>      d=  Image._getdecoder(self.mode,  d,  a,  self.decoderconfig)
> AttributeError:  'module'  object has no attribute'_getdecoder'|||

Do you have your own module named Image.py?

-- 
John Gordon         Imagine what it must be like for a real medical doctor to
gordon@panix.com    watch 'House', or a real serial killer to watch 'Dexter'.

[toc] | [prev] | [next] | [standalone]


#61115

FromChristian Gollwitzer <auriocus@gmx.de>
Date2013-12-06 07:54 +0100
Message-ID<l7rsac$7hv$1@dont-email.me>
In reply to#61107
Am 05.12.13 21:26, schrieb tastyminerals:
> Hi, I am getting an error when trying to use Pillow library to display
> image PNG  on a Tkinter Button widget. Here is my code.
>
> |image=  Image.open(os.path.join('icons','bulb.png'))  # using PIL for png images
>          self.correctGuessImage=  ImageTk.PhotoImage(image)

I don't know what is the problem here, but Tk supports PNG natively from 
8.5 onwards; just use

	self.correctGuessImage=  ImageTk.PhotoImage(file='bulb.png')

Christian

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web