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

i wasn't able to find a precompiled version of Tk::PNG for win32 ... so i wrote something to be able to view png's:
if ($OSNAME =~ /linux|unix|bsd/i){ require Tk::PNG; $image = $pic_window->Photo("button", -file => $photo_name, -format => 'png'); } elsif ($OSNAME =~ /win/i ){ require GD; require Tk::JPEG; require MIME::Base64; my $im = GD::Image->newFromPng($photo_name); my $img = MIME::Base64::encode_base64($im->jpeg()); $image = $pic_window->Photo("button", -data => $img, -format => 'jpeg'); } my $label= $pic_window->Label(-image => "button");
but there must be a better way to do this... perhaps anyone has a better idea or a version of Tk::PNG for win32 ...

----
NaSe
:x

Replies are listed 'Best First'.
Re: Viewing .png's under win32 / There must be a better way....
by PodMaster (Abbot) on Aug 29, 2002 at 10:56 UTC
      thanks for the hint i'll use that

      ----
      NaSe
      :x

Re: Viewing .png's under win32 / There must be a better way....
by particle (Vicar) on Aug 29, 2002 at 13:30 UTC
    elsif ($OSNAME =~ /win/i ){
    this will also match Darwin, which may not be what you want. be careful when determining the os.

    ~Particle *accelerates*

      that is right - i havent thought of this in fact ... but i dont think that my chef will use the script on a darwin machine - i am even pretty shure she will use it only on her win2000 box ;)

      ----
      NaSe
      :x