[Tutor] Storing tk canvas as PNG file...........

Suresh Kumar Suresh Kumar" <suresh_vsamy@rediffmail.com
Wed Jul 2 12:31:01 2003


Hi,
     Iam using python2.2/tkinter/windows. My doubt is regarding 
how to convert tkiner canvas as a PNG file? I have drawn some 
rectangles in my canvas. The canvas size is larger than the 
screen.

    Initially i used  "ImageGrab"  to grab the entire canvas. But 
the ImageGrab approach doesn't work in my case, since it copies 
pixels from the display, i couldn't  able to grab the entire 
canvas. To overcome this problem i used Postscript generation 
mechanisms provided by the Canvas widget and coverted the canvas 
to a postscript file. In this case i converted entire canvas into 
a postscript file. The problem with Postscript format is, we need 
Ghostscript viewer to view the Postcript image which we have to 
install separately. Since most of the systems running under 
Windows OS will have "Microsoft Photo Editor", it would be nice to 
have a PNG file rather than PostScript file.

     Is there any way to store the entire canvas as a PNG file? 
Otherwise how can i convert a postscript file to PNG or BMP file 
in Python? Is it possible to convert postscript file to PNG file 
in python? Anyother solution.......?

      I need the solution urgently. Earlier replies are welcome.

With Regards,
V.Suresh Kumar

___________________________________________________
Click below to experience Sooraj R Barjatya's latest offering
'Main Prem Ki Diwani Hoon' starring Hrithik, Abhishek
  & Kareena http://www.mpkdh.com