Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Image Magick and Tk

by grummerX (Pilgrim)
on Mar 05, 2002 at 11:35 UTC ( [id://149331]=note: print w/replies, xml ) Need Help??


in reply to Image Magick and Tk

You can do this by using Image::Magick's ImageToBlob function and encoding the data with MIME::Base64.
#!/usr/bin/perl -w use strict; use Tk; use Image::Magick; use MIME::Base64; my $mw = MainWindow->new; my $image = Image::Magick->new; $image->Read('foo.gif'); # Perform any Magick manipulation here ... my ($blob) = $image->ImageToBlob(); my $buttonImage = $mw->Photo(-data => encode_base64($blob)); $mw->Button(-image => $buttonImage)->pack; MainLoop;
Thanks to Jouke for the pointer on using MIME::Base64 to encode Tk images.

-- grummerX

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://149331]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-23 19:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found