in reply to when i display a gif image in tk, the bottom half is black, why?

There was a bug in certain Tk versions (I think 800.024 was among them) which caused not calling "binmode" internally on image files.

You may workaround the problem either by switching to a newer Perl/Tk version (I think both Tk800.025 and Tk804.027 should do), or use the -data option instead of the -file option to load the file. From memory, untested:

use MIME::Base64; { local $/ = undef; open(my $fh, "image1.gif") or die; binmode $fh; $buf = <$fh>; } $mw->Photo("image1", -data => encode_base64($buf));
  • Comment on Re: when i display a gif image in tk, the bottom half is black, why?
  • Download Code

Replies are listed 'Best First'.
Re: Re: when i display a gif image in tk, the bottom half is black, why?
by Courage (Parson) on May 11, 2004 at 15:35 UTC
    surprisingly, current perl binary for perl-5.8.3 provided by ActiveState (build 809) have Tk800.024 with this problem not solved.

    Namely, "widget" demo suffers from this at item #7 and #8

    I wonder why they didn't included 800.025, which was available at a time of build...

    Courage, the Cowardly Dog