Saving Tkinter images?

Eric Brunel eric.brunel at pragmadev.com
Wed Feb 6 04:42:05 EST 2002


Hi Dustin,

> I'm interested
> if there is some way to save an image (eg. to a jpeg or png) that has
> been drawn to a Tkinter canvas.  I'm guessing there isn't but I
> thought I'd at least ask.

The only way I know to do that programmatically is to dump the canvas image 
as a postscript file using the "postscript" method on canvases, then use an 
external utility to convert the postscript to jpeg or png.
If you want to do that, there's an almost universal image conversion 
utility named "convert" that's part of ImageMagick 
(http://www.imagemagick.org), that runs almost everywhere.

HTH
 - eric -



More information about the Python-list mailing list