O Wise Ones,
I am using Image::ExifTool to read a custom (unknown) tag from a TIFF file, and it is returning the following:
Exif 0x866c : 76 73 0 4 244 1 0 0 0 ...
I need to code this into a series of 32-bit values. For example, the first four values (76,73,0,4) would be expressed in hex as 0x0400494c (note the bytes are reversed). Similarly, the next four values (244,1,0,0) would be expressed in hex as 0x000001f4. I'm currently doing this with some splits:
$offset = join('',reverse map { sprintf '%02x',$_ } (split(' ',$info))[0..4];
then converting to decimal to use as a byte offset:
seek(FILE,hex($offset),0);
Is this really the best way to do it, or is there some pack-fu that I should use? Thanks!
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.