in reply to Re^2: Downloading KeyForge image
in thread Downloading KeyForge image

Seems to only work if you base64 encode the binary

use 5.010; use strict; use warnings; use LWP::UserAgent; use Tk; use Tk::PNG; use MIME::Base64; my $url = 'http://www.perl.com/images/ads/tpcip_banner-1200x150.png'; my $ua = LWP::UserAgent->new(agent => ''); my $response = $ua->get($url); die $response->status_line if not $response->is_success; my $data = MIME::Base64::encode_base64($response->decoded_content()); my $mw = MainWindow->new; my $photo = $mw->Photo(-data => $data, -format => 'PNG'); $mw->Label(-image => $photo)->pack(); MainLoop;
poj

Replies are listed 'Best First'.
Re^4: Downloading KeyForge image
by Stamm (Sexton) on May 21, 2019 at 21:07 UTC

    Thank you! Yes it works with Base64. It's weird, the doc says it accepts binary in addition to Base64.

    Thanks again.

      There is an old thread from 2006 about it here

      poj