473,386 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

displaying pgm file in python

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
1 5940
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Christian Wilcox | last post by:
I'm trying to programmatically access information from a telnet session which is normally accessed with a telnet program capable of terminal emulation (currently set at VT320). The initial login...
0
by: Fuzzyman | last post by:
Does anyone know of an 'easy' way of displaying HTML from python - preferably using standard Tkinter widgets. I've heard that the 'Text' widget can be used to do this - but I don't fancy hand...
9
by: matthiasjanes | last post by:
Hi, Maybe someone of you can help me. I'm trying to display an image in memory(open file) with an cgi script - but it want work proberly: I'm running an Cgi webserver (CgiServerGui.py). ...
5
by: Darren Dale | last post by:
I am using Emacs Python mode, and my project involves reading large datafiles and processing large arrays. I have some code that reports the progress during these time consuming processes. It works...
1
by: Waguih Boctor | last post by:
Hi, I have a number of ASP pages where some JPGs and GIFs are displaying in the browser and some are not. I have included an excerpt from the HTML below. In this example, the gif file at the...
2
by: Joe Price | last post by:
Hi chaps I've got an XML file, within that file i've embedded html code using the <!]> tag I'm displaying that xml file through a browser using an xsl style sheet. However it is displaying...
2
by: Carole MacDonald | last post by:
There have been lots of posts on this topic, but I haven't been able to apply any of the suggestions to my situation. I have an .aspx page with a form on it that has several submit buttons on...
11
by: prats | last post by:
I want to write a GUI application in PYTHON using QT. This application is supposed to take in Japanese characters. I am using PyQt as the wrapper for using QT from python. I am able to take input...
2
by: sj | last post by:
I am just learning to use Tkinter and am having problems displaying image files. I am able to display an image using tutorials (such as http://www.daniweb.com/code/snippet296.html) But when I try...
1
by: mzewuge | last post by:
I have a problem of displaying a geotif satellite imagery in python. Any one who can give me a hint pls. Thank you in advance
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.