Use tha bbox('all') and the postscript capture, then convert it to whatever you want.
$mw->Button(
-text => "Save PS",
-command => [sub {
$canv->update;
my @capture=();
my ($x0,$y0,$x1,$y1)=$canv->bbox('all');
print "$x0,$y0,$x1,$y1\n";
@capture=('-x'=>$x0,'-y'=>$y0,-height=>$y1-$y0,-width=>$x1-$x
+0);
$canv->postscript(-colormode=>'color',
-file=> "$0.ps",
-rotate=>0,
-width=>2400,
-height=>3400,
@capture);
system("convert $0.ps $0.png");
}
] )->pack;
|