displaying pgm file in python

wilson wilson.t.thompson at gmail.com
Fri Apr 4 18:07:59 EDT 2008


i converted an 8bit rgb .jpg file into .pgm using adobe photoshop and
a plugin from http://photoshop.pluginsworld.com/plugins/adobe/362/richard-rosenman/portable-pixmap-importer-exporter.html
I want to check if this file can be properly displayed.
Image opening and show() in PIL fails to do it so i tried Tkinter

i created a canvas in a tkinter gui and tried
self.myimg=PhotoImage(file="mytestpic.pgm")
 
self.selimgtag=self.canvorig.create_image(70,100,image=self.myimg)
self.canvorig.update_idletasks()

this causes AttributeError snd says can't identify image file
I checked the asci text of .pgm file ,it starts with a line P2 and
then several lines with integers..can someone tell me if there is a
way to display this properly

thanks
W



More information about the Python-list mailing list