[Image-SIG] Trying to display a BMP image

Joerg Baumann Joerg.Baumann@stud.informatik.uni-erlangen.de
Sat, 25 Mar 2000 15:57:59 +0100 (MET)

On Fri, 24 Mar 2000, William Peloquin wrote:

> Hi,
> I am trying to load a BMP image and display it in a label. I am pretty ne=
> to using PIL, and I have not used Python in quite a while. I will appreci=
> any hints!

Your problems seem to be with Tkinter.
Here is a working version of your fragment.

import Tkinter
import Image,ImageTk


img =3D Image.open('im000001.bmp')

print 'mode =3D ', img.mode
print 'size =3D ', img.size

pi =3D ImageTk.PhotoImage(img)

Tkinter.Label(liveRawF, image=3Dpi).pack(side=3DTkinter.TOP,
expand=3DTkinter.YES, fill=3DTkinter.BOTH)=20


Certainly you can use "from .. import .." instead of "import ..", but this
way it=B4s clear where things come from.

hope this is a helpful hint,


  Joerg Baumann       joerg.baumann@stud.informatik.uni-erlangen.de
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ =20
  Beware of bugs in the above code; I have only proved it correct,=20
  not tried it.
                  Don Knuth=20