Greetings,
I am trying to figure out how to get the RAW Exif Information for storage into a database using the Perl API. The examples show retrieving the data as strings, etc, but i would prefer to store the low level tagID's in the tables for space and speed reasons.
It looks like i want to use the ExtractInfo API since the ImageInfo does string conversions that i don't need. (not sure though).
1. ExtractInfo
2. GetInfo ? for the Group/TagId's and Raw Data ?
Thoughts anyone ?
Thanks !
PS - This API absolutely rocks.
You can already get the raw data by appending a # to the tag name. Would that serve your purpose?
(Note: in perl everything is always a string, so I don't know if the raw data is going to help you here)
Try extracting only the EXIF data block using the "EXIF" tag. (See the Extra tags documentation for details.)
- Phil
Hayo,
I am trying to record every tag that is present in the file into a database, but i want to store based on the GROUP/ID so that i can search easier, and not store as much. I am probably ok storing the data values as strings i guess, I can use raw in perl using pack/unpack if not, so thats not an issue.
Phil,
Thanks, that moves me farther along... i was able to get the block out of the file.
my $Exif = new Image::ExifTool;
my $Info = $Exif->ImageInfo("./IMG_0649.JPG", "EXIF");
my $SREF = $Info->{EXIF};
my $RAW = unpack("H*", $$SREF);
printf("RAW : \"$RAW\" \n");
RAW : "4d4d002a00000008000b010f00020000000600000092011000020000000e00000098011200030000000100060000011a000500000001000000a6011b000500000001000000 .... <much more follows>
I think the easiest thing would be to get the string list, and then use "GetTagID" to get the tag ID for storage. After looking through your code, its clear the string conversion on the values is worth keeping as a strings. (Seriously, damn near heroic work there...)
Thanks Again !
[edit] corrected name.
All,
Just in case someone comes across this post and wants to know, here is how i get all the raw information...
my $Exif = new Image::ExifTool;
$Exif->Options(Group0 => ['EXIF']);
my $Info = $Exif->ImageInfo($Filename);
foreach (keys %$Info)
{
my $Tag = $Exif->GetTagID($_);
my $Group = $Exif->GetGroup($_, 1);
my $Raw = $Exif->GetValue($_, 'Raw');
printf(" %8.8s, %5.5d, %s \n", $Group, $Tag, $Raw);
}
Produces :
IFD0, 00531, 1
ExifIFD, 37383, 5
IFD1, 00513, 2066
ExifIFD, 37386, 4.15
ExifIFD, 40960, 0100
ExifIFD, 37121, 1 2 3 0
ExifIFD, 41989, 29
IFD0, 00306, 2016:01:01 20:07:42
ExifIFD, 33434, 0.25
ExifIFD, 37380, 0.00390625
ExifIFD, 41986, 0
IFD0, 00282, 72
ExifIFD, 34850, 2
ExifIFD, 34855, 160
ExifIFD, 42034, 4.15 4.15 2.2 2.2
ExifIFD, 37522, 004
ExifIFD, 42036, iPhone 6 Plus back camera 4.15mm f/2.2
ExifIFD, 42035, Apple
Ah, I see. Sorry, I didn't have much time to respond earlier and didn't quite understand what you were trying to do, but I'm glad you've found a solution.
- Phil