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, );

In reply to Canvas screen capture to GIF on MSWindows systems by vertigomagic

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.