Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Incremental Image Loading

by renegadex (Beadle)
on Nov 17, 2008 at 23:12 UTC ( #724147=perlquestion: print w/replies, xml ) Need Help??

renegadex has asked for the wisdom of the Perl Monks concerning the following question:

hi! can i use the Gtk2::Gdk::PixbufLoader to load an image from a file? I wanted to create thumbnails for many pictures and this takes up alot of time. So what I need to do is incrementally load those images, at the same time, the user can do other things (click a button) without waiting for the images to load.

Replies are listed 'Best First'.
Re: Incremental Image Loading
by Anonymous Monk on Nov 18, 2008 at 08:18 UTC
Re: Incremental Image Loading
by zentara (Archbishop) on Nov 18, 2008 at 13:26 UTC
    To load a pixbuf from file:
    #get raw image data #my $image_data = `cat image.png`; # easy shell out my $image_data; open (FH,"< image.png"); read( FH, $image_data, -s FH ); close FH; my $pixbuf = do { my $loader = Gtk2::Gdk::PixbufLoader->new(); $loader->write( $image_data ); $loader->close(); $loader->get_pixbuf(); }; #you can then make your thumbnails with the pixbuf methods my $pixbuf_smaller = $pixbuf->scale_simple(50,50,'bilinear'); my $img_smaller = Gtk2::Image->new_from_pixbuf($pixbuf_smaller);

    I'm not really a human, but I play one on earth Remember How Lucky You Are

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2022-05-29 04:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (101 votes). Check out past polls.

    Notices?