Jul 31, 2015, 10:40 AM
Post #3 of 6
The Tk::canvas doesn't support saving drawing into other format except ps format.
Re: [FishMonger] How to save drawings on perl Tk::canvas into jpg png gif bmp tif file ?
[In reply to]
And I have a try to use Tk::Photo module as following:
my $image = Image::Base::Tk::Photo->new (-for_widget =>$mw,
-width => 100,
-height => 100);
$image->rectangle (0,0, 99,99, 'white');
$image->xy (20,20, 'black');
$image->line (50,50, 70,70, '#FF00FF');
$image->line (50,70, 70,50, '#0000AAAA9999');
unfortunately, the code ' $image->save ('c:\filename.png');' report "use of uninitilized value $format in lc at strawberry/perl/site/lib/Image/Base/Tk/Photo.pm line 150; Tk::Error: image file format "" is unknown at strawberry/perl/site/lib/Tk.pm line 251", so there is no output. How to fix this problem? and could you write me a perl demo by using Photo module like canvas module with drawing line,text,rectangle,oval, and then saving the drawings into png file?
(This post was edited by kaiwang on Jul 31, 2015, 10:41 AM)