[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-win32-users
Subject:    Re: Unable to display PNG image in TK
From:       Randy Kobes <randy () theoryx5 ! uwinnipeg ! ca>
Date:       2003-06-26 17:14:16
[Download RAW message or body]

On Thu, 26 Jun 2003, Towne.Makela wrote:

> Hi all,
>
> I've been trying to get a PNG image to display properly...
> Well, in this case, at all.
>
> TK::Photo works with bitmaps, blah, blah, blah.  So I went and
> found TK::PNG.  But I can't seem to get the module to work
> properly.  The ol' can't locate in @INC message...  I had the
> same problem with GD too until I managed to open up a message
> one day that had the glorious solution.  So, I'm hoping that
> someone has had the unfortunate luck with this as well, but
> managed to get it working.  I'm using Perl 5.6 on a Win2K
> professional machine if that helps at all.

There's been attempts to compile Tk::PNG on Win32, but as far as
I know, these haven't been successful yet. It can build, but
fails in its tests. The following's not ideal, but as a
workaround, you can use Tk::JPEG to load a jpeg image - Tk::JPEG
I believe is available from ActiveState's repository for 6xx
builds, and we have it at http://theoryx5.uwinnipeg.ca/ppms/ for
8xx builds. The GD module can be used to convert png to jpeg,
if you need a Perl solution:

use GD;
my $file = shift || die << "USAGE";
Usage: $0 file.png
USAGE

my $im = GD::Image->newFromPng($file) || die $!;
(my $out = $file) =~ s/\.png$/.jpeg/;
open my $fh, ">$out" or die $!;
binmode $fh;
print $fh $im->jpeg;
close $fh;

-- 
best regards,
randy kobes
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic