vertigomagic has asked for the wisdom of the Perl Monks concerning the following question:

Hi there, i know this question was discussed on some topics before, but up to now i didn't get a really satisfying solution for that kind of problem.

I need to convert the graphic contents of my canvases to any image format, preferrably GIF or PNG. I tried out most of the different ways like described on perlmonks or anywhere else. The two solutions i found up to now are:

1. Using the canvas->postscript method, which didn't satisfy me at all because of the loss of quality, especially regarding the fonts, font sizes, etc.; Also the need of some external convertion of the PS to GIF by "convert" for instance seems to me not much more than a workaround.

2. The other - apparent ideal - way is to use WinPhoto. But that comes with two major troubles: The first is, that on my Linux-System WinPhoto is thery time consuming (at least 5 secs for the ->Photo method) when storing the canvas content into an image. The other, much bigger problem is, that WinPhoto isn't available on MSWindows systems, is it? And my customer runs the scripts on MSWindows, no chance to convince him to Linux ;-)

Is there really no other way than these two options to save a canvas to a GIF-image? Maybe someone knows a way, how to speed up WinPhoto and use it on MSWindows systems.

Thx in advance,

Markus.


The code i'm using is:

use Tk::WinPhoto; my $imgsheet = $canwellsketch->Photo( -format => 'Window', -data => oct( $canwellsketch->id ), ); $imgsheet->write( "screenshot.gif", -format => 'GIF' );
or
$canwellsketch->postscript( -file => "test.ps", -x => ( $canwellsketch->bbox( "all" ) )[0], -y => ( $canwellsketch->bbox( "all" ) )[1], -width => 600, -height => 400, -pagewidth => 600, );

Replies are listed 'Best First'.
Re: Canvas screen capture to GIF on MSWindows systems
by SuicideJunkie (Vicar) on Aug 26, 2009 at 16:48 UTC
Re: Canvas screen capture to GIF on MSWindows systems
by lamprecht (Friar) on Aug 27, 2009 at 14:51 UTC
    Hi,

    I doubt you will get better quality using a screenshot vs. postscript. Maybe using the -fontmap option with canvas->postscript could help improving your images quality?


    Cheers, Christoph