By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,931 Members | 2,015 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,931 IT Pros & Developers. It's quick & easy.

displaying pgm file in python

P: n/a
i converted an 8bit rgb .jpg file into .pgm using adobe photoshop and
a plugin from http://photoshop.pluginsworld.com/pl...-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,i mage=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
Apr 4 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
En Fri, 04 Apr 2008 19:07:59 -0300, wilson <wi***************@gmail.com>
escribió:
i converted an 8bit rgb .jpg file into .pgm using adobe photoshop and
a plugin from
http://photoshop.pluginsworld.com/pl...-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 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
P2 is a rather old variant that it's not in use anymore AFAIK. Try
replacing P2 with P5; at least PIL should recognize it, I think. PIL can
read and write .pgm, why don't you do the conversion with PIL?

--
Gabriel Genellina

Apr 4 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.