From: Armin Roehrl Date: 2001-11-06T09:13:35+09:00 Subject: [ruby-talk:24436] How to dump a canvas into a png-file? Hi, It is possible to dump a canvas in a postscript file. Without using some external conversion prg from ps to png is there a trick to convert the canvas into a png/jpeg/gif/whatever image? I had a quick look in tkcanvas.rb.. but no luck. Thanks a lot, I put the ps-example below.. taken from the Japanese Ruby-Tk FAQ. Cheers, Armin. -- #!/usr/local/bin/ruby require "tk" min_x = 0 min_y = 0 c = TkCanvas.new i = TkcLine.new(c, 0, 0, 50, 50) c.pack ps = c.postscript('x' => min_x, 'y' => min_y, 'width' => c.cget('width'), 'height' => c.cget('height')) f = open('file.ps', 'w') f.print ps f.close Tk.mainloop ----------------------------------------------- Armin Roehrl, http://www.approximity.com "The best way to predict the future is to invent it." --Alan Kay