GTK2 Exif Thumbnail Reader

Submitted by:Jhon Smith

Date added:19 April, 2011

Category:Perl

This snippet shows how to get the thumbnail from exif metadata. This is very useful for generating very fast thumbnails!! I hope many would benefit from this.

Tags: thumbnail reader

Code Snippet:

use Image::ExifTool qw(ImageInfo);
my $exifTool = new Image::ExifTool;
$exifTool->Options(Binary => 1);
my $info = $exifTool->ImageInfo('image_file.jpg', 'thumbnailimage');
my $data = ${$$info{ThumbnailImage}};
my $loader = Gtk2::Gdk::PixbufLoader->new();
$loader->write($data);
$loader->close();
$pixbuf = $loader->get_pixbuf();


since you are able to make the thumbnail into a pixbuf then you may now use your favorite widget to preview the thumbnail.

the $exifTool is an Image::ExifTool, so you need this module to make it work. you can yum it using... yum install perl-Image-ExifTool.
 
 

Comments