E
Eric McDaniel
I am trying to read in a bunch of images and manipulate them using
Image::Magick, then display them using Tk:hoto. I would like to do this
without creating a temp file for each image, since there can be quite a few
of them.
However, I can't make Tk:hoto understand the data returned by
Image::Magick's ImageToBlob() function. Here is the way I had hoped it would
work:
#!perl
use strict;
use warnings;
use Tk;
use Image::Magick;
my $image = Image::Magick->new();
$image->read('c:\Documents and Settings\ericm\My Documents\My
Pictures\earthris.gif');
# Do various Image::Magick manipulations here...
# ...
my $blob = $image->ImageToBlob();
# Set up Tk windows
my $main = MainWindow->new();
my $photo = $main->Photo('img', -format=>'GIF', -data=>$blob );
$main->Label('-image' => 'img', -height=>200, -width=>200)->pack;
MainLoop;
###################################
This code generates the error "couldn't recognize image data at
C:/Perl/site/lib/Tk/Image.pm line 21." in the call to $main->Photo.
If I create a temp file with $image->write() and read it in using the
$main->Photo(-file=>'...') syntax, it works fine.
Any suggestions?
Thanks in advance.
-Eric
Image::Magick, then display them using Tk:hoto. I would like to do this
without creating a temp file for each image, since there can be quite a few
of them.
However, I can't make Tk:hoto understand the data returned by
Image::Magick's ImageToBlob() function. Here is the way I had hoped it would
work:
#!perl
use strict;
use warnings;
use Tk;
use Image::Magick;
my $image = Image::Magick->new();
$image->read('c:\Documents and Settings\ericm\My Documents\My
Pictures\earthris.gif');
# Do various Image::Magick manipulations here...
# ...
my $blob = $image->ImageToBlob();
# Set up Tk windows
my $main = MainWindow->new();
my $photo = $main->Photo('img', -format=>'GIF', -data=>$blob );
$main->Label('-image' => 'img', -height=>200, -width=>200)->pack;
MainLoop;
###################################
This code generates the error "couldn't recognize image data at
C:/Perl/site/lib/Tk/Image.pm line 21." in the call to $main->Photo.
If I create a temp file with $image->write() and read it in using the
$main->Photo(-file=>'...') syntax, it works fine.
Any suggestions?
Thanks in advance.
-Eric