Loading a EXIF thumbnail with Gtk2::Gdk::Pixbuf->new_from_data



Hi All,

This is my first message to the list.

I'm trying to display the thumbnail data which is stored in the EXIF
header of images. 
I thought I had to use Gtk2::Gdk::Pixbuf->new_from_data but I could be
completely wrong.
This is my code:

 my $data = pack( 'a*', ${ $image->get_exif->{ThumbnailImage} } );
    
 my $pixbuf = Gtk2::Gdk::Pixbuf->new_from_data($data,'rgb',0,8,$width,
$height,$width * 3);

And then I'll display it with:

 my $image_widget = Gtk2::Image->new_from_pixbuf($pixbuf);

BUT, the thumbs are scrambled (snowy black). 

I used to load the the image file with new_from_file, and then scaled it
to a thumbnail size. But, this isn't as fast as just loading the the
thumb from a file ofcourse.

The perldoc of Gtk2::Gdk::Pixbuf suggests that I have to pack the $data,
but, I don't know how.

For clarification: my $image variable is an object which will
retrieve/set exif information, it's based on Image::ExifTool. The output
returned by $image->get_exif->{ThumbnailImage} is correct, cuz I've
already dumped this to a file, and yes, it is a thumbnail ;-)

Any help will be greatly appreciated,

Cheers,
Johnny
-- 

Johnny Morano | insaniac moretrix com | +32.473 894685
[ perl rookie ] | [ linux geek ] | [ web kid ] | [ all ]
'%*;s{}{ohn};s.$.n.;;%@;s|(.*?)$|$1y|;s%^%j%;%;;print;*%'





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]