Hey Monkies,

I'm trying to load the EXIF thumbnail from images, when they are present in the EXIF header, within Gtk2. The perldoc of Gtk2::Gdk::Pixbuf says I have to use pack(), so I can pass the data to Gtk2::Gdk::Pixbuf->new_from_data();


This is my code:
my $thumb = pack('a*',${ $image->get_exif->{ThumbnailImage} }); my $pixbuf = Gtk2::Gdk::Pixbuf->new_from_data($thumb,'rgb',TRU +E,8,160,120,640);

$image is an object which retrieves EXIF information, it works... I've already dumped the output to a file, it's an image. That's how I found out what the width and height were.
Now, my problem is that all thumbs are 'mangled'.. they're snowy black :-/

Any help, tips, pointers to URLs/docs is greatly appreciated!

Thanks,
a confused monkie..

to ask a question is a moment of shame
to remain ignorant is a lifelong shame


In reply to How to use pack() with Gtk2::Gdk::Pixbuf by insaniac

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.