Jeff,

I can give that a try. I have seen the Tkx::eval used with a single line 
command, but not a whole procedure. So, can you point me to some examples of 
how to do this? Or can I just inside my PERL code doe something like:

my $canvas;
my $image;
.
.
.
do some PERL things with the canvas....
do some more PERL things
.
.
.
Tkx::eval(
tcl line1
tcl line2

.
.
.
image create photo $image \
         -height $height -width $width
.
.
.
tcl linen
tcl linen+1
);
more PERL code...

thanks,
gary


________________________________
 From: Jeff Hobbs <je...@activestate.com>
To: gary sachs <conversecoroll...@yahoo.com> 
Cc: 'Tcl/ Tk Mailing List' <tcltk@perl.org> 
Sent: Thursday, May 3, 2012 6:27 PM
Subject: Re: Img
 
On 03/05/2012 1:54 PM, gary sachs wrote:
> I did find the img::window which has pushed me further down the road. But, it 
> leads me to some questions about trying to write a PNG or JPEG file of a 
> canvas. When I do the writing, it seems that it can take 10 seconds or longer 
> to complete and then there is only a partial drawing in the PNG file. So, 
> here is the small code fragment I am trying...
> 
> my $img = Tkx::image_create_photo(-data =>  $mycanvas, -format =>  'window');
> $img =  Tkx::widget->new($img);
> $img->write ($filename, -format =>  'JPEG');
> 
> ... again it works so to speak.
> 
> How do I get the entire visble canvas into the PNG? Or for that matter, how 
> would I get the entire canvas, visible objects and not visible in the window, 
> written to the PNG file? Any way to speed things up? I would like to not have 
> to resort to IMAGEMAGICK and GHOSTSCRIPT if possible.

I'm not sure why it would take 10 seconds, though if $mycanvas is really large, 
it may be passing a lot of data over the Perl<>Tcl bridge.  Note that the 
'window' format really is about just capturing the visible window.  There are 
numerous tricks and techniques that people have tried to get the whole canvas.  
They are best shown here:
    http://wiki.tcl.tk/1404

Try the canvas2Photo method shown there.  Remember that you can just push this 
all to Tcl with an eval call rather than try and translate it to Perl.

Jeff

Reply via email to