in reply to Tk:Photo -data with binary data?

It looks like your (and my, and everyone else who has commented so far's) expectation of what "the image as a string" and "binary data" means doesn't jive with what it acctually means. Try this out and it works okay...

#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::Photo; use Tk::PNG; my $file = shift or die "put a PNG file name on the command line"; my $mw = new MainWindow(); my $src = $mw->Photo(-format => 'png', -file => $file); my $tgt = $mw->Photo(-format => 'png', -data => $src->data(-format => +'png')); $mw->Label(-image => $tgt )->pack; MainLoop;

Inspecting the output of src->data(-format => 'png') to understand what exactly the differnce is is left as an excercise for the reader.

Replies are listed 'Best First'.
Re^2: Tk:Photo -data with binary data?
by ikegami (Patriarch) on Nov 29, 2006 at 07:22 UTC
    Turns out it's a Base64-encoded version of the original .png. I say version because it's has been transformed, but it's still a .png, no more no less.