displaying pgm file in python

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Apr 5 00:46:11 CEST 2008

En Fri, 04 Apr 2008 19:07:59 -0300, wilson <wilson.t.thompson at gmail.com>  

> 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 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

More information about the Python-list mailing list