Dec 28, 2013

HowTo: Get Exif Thumbnail from Images using Perl Gtk2
- this will extract a thumbnail inside the exif metadata embedded in the jpeg file.
- we use this technique to help speed up generating a thumbnail image by simply getting it instead of making a thumbnail yourself
- this is for demonstration purposes only
- written in windows using activeperl

#!/usr/bin/perl -w

use strict;
use Gtk2 '-init';
use Image::ExifTool qw(ImageInfo);
my $exifTool = Image::ExifTool->new();
$exifTool->Options(Binary => 1);

my $window = Gtk2::Window->new();

my $image = Gtk2::Image->new();


sub load_thumbnail {
my ($file) = @_;
my $info = $exifTool->ImageInfo($file, 'thumbnailimage');
my $data = ${$$info{ThumbnailImage}};
my $loader = Gtk2::Gdk::PixbufLoader->new();
my $pixbuf = $loader->get_pixbuf();
return $pixbuf;


No comments:

Post a Comment