source: main/trunk/greenstone2/perllib/cpan/Image/ExifTool/Apple.pm@ 34921

Last change on this file since 34921 was 34921, checked in by anupama, 3 years ago

Committing the improvements to EmbeddedMetaPlugin's processing of Keywords vs other metadata fields. Keywords were literally stored as arrays of words rather than phrases in PDFs (at least in Diego's sample PDF), whereas other meta fields like Subjects and Creators stored them as arrays of phrases. To get both to work, Kathy updated EXIF to a newer version, to retrieve the actual EXIF values stored in the PDF. And Kathy and Dr Bainbridge came up with a new option that I added called apply_join_before_split_to_metafields that's a regex which can list the metadata fields to apply the join_before_split to and whcih previously always got applied to all metadata fields. Now it's applied to any *Keywords metafields by default, as that's the metafield we have experience of that behaves differently to the others, as it stores by word instead of phrases. Tested on Diego's sample PDF. Diego has double-checked it to works on his sample PDF too, setting the split char to ; and turning on the join_before_split and leaving apply_join_before_split_to_metafields at its default of .*Keywords. File changes are strings.properties for the tooltip, the plugin introducing the option and working with it and Kathy's EXIF updates affecting cpan/File and cpan/Image.

File size: 5.4 KB
Line 
1#------------------------------------------------------------------------------
2# File: Apple.pm
3#
4# Description: Apple EXIF maker notes tags
5#
6# Revisions: 2013-09-13 - P. Harvey Created
7#
8# References: 1) http://www.photoinvestigator.co/blog/the-mystery-of-maker-apple-metadata/
9#------------------------------------------------------------------------------
10
11package Image::ExifTool::Apple;
12
13use strict;
14use vars qw($VERSION);
15use Image::ExifTool::Exif;
16use Image::ExifTool::PLIST;
17
18$VERSION = '1.05';
19
20# Apple iPhone metadata (ref PH)
21%Image::ExifTool::Apple::Main = (
22 WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
23 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
24 WRITABLE => 1,
25 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
26 NOTES => 'Tags extracted from the maker notes of iPhone images.',
27 # 0x0001 - int32s: seen 0,1,2,3,4,9
28 # 0x0002 - binary plist with a single data object of size 512 bytes (iPhone5s)
29 0x0003 => {
30 Name => 'RunTime', # (includes time plugged in, but not when suspended, ref 1)
31 SubDirectory => { TagTable => 'Image::ExifTool::Apple::RunTime' },
32 },
33 # 0x0004 - int32s: normally 1, but 0 for low-light images
34 # 0x0005 - int32s: seen values 113-247, and 100 for blank images
35 # 0x0006 - int32s: seen values 27-258, and 20 for blank images
36 # 0x0007 - int32s: seen 1
37 0x0008 => { #1
38 Name => 'AccelerationVector',
39 Groups => { 2 => 'Camera' },
40 Writable => 'rational64s',
41 Count => 3,
42 # Note: the directions are contrary to the Apple documentation (which have the
43 # signs of all axes reversed -- apparently the Apple geeks aren't very good
44 # with basic physics, and don't understand the concept of acceleration. See
45 # http://nscookbook.com/2013/03/ios-programming-recipe-19-using-core-motion-to-access-gyro-and-accelerometer/
46 # for one of the few correct descriptions of this). Note that this leads to
47 # a left-handed coordinate system for acceleration.
48 Notes => q{
49 XYZ coordinates of the acceleration vector in units of g. As viewed from
50 the front of the phone, positive X is toward the left side, positive Y is
51 toward the bottom, and positive Z points into the face of the phone
52 },
53 },
54 # 0x0009 - int32s: seen 19,275,531,4371
55 0x000a => {
56 Name => 'HDRImageType',
57 Writable => 'int32s',
58 PrintConv => {
59 # 2 => ? (iPad mini 2)
60 3 => 'HDR Image',
61 4 => 'Original Image',
62 },
63 },
64 0x000b => {
65 Name => 'BurstUUID',
66 Writable => 'string',
67 Notes => 'unique ID for all images in a burst',
68 },
69 # 0x000c - rational64s[2]: eg) "0.1640625 0.19921875"
70 # 0x000d - int32s: 0,1,6,20,24,32,40
71 # 0x000e - int32s: 0,1,4,12 (Orientation? 0=landscape? 4=portrait? ref 1)
72 # 0x000f - int32s: 2,3
73 # 0x0010 - int32s: 1
74 0x0011 => {
75 Name => 'MediaGroupUUID', #NealKrawetz private communication
76 # (changed in 12.19 from Name => 'ContentIdentifier', #forum8750)
77 Writable => 'string',
78 },
79 # 0x0014 - int32s: 1,2,3,4,5 (iPhone 6s, iOS 6.1)
80 0x0015 => {
81 Name => 'ImageUniqueID',
82 Writable => 'string',
83 },
84 # 0x0016 - string[29]: "AXZ6pMTOh2L+acSh4Kg630XCScoO\0"
85 # 0x0017 - int32s: 0,8192
86 # 0x0019 - int32s: 0,2,128
87 # 0x001a - string[6]: "q825s\0"
88 # 0x001f - int32s: 0
89);
90
91# PLIST-format CMTime structure (ref PH)
92# (CMTime ref https://developer.apple.com/library/ios/documentation/CoreMedia/Reference/CMTime/Reference/reference.html)
93%Image::ExifTool::Apple::RunTime = (
94 PROCESS_PROC => \&Image::ExifTool::PLIST::ProcessBinaryPLIST,
95 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
96 NOTES => q{
97 This PLIST-format information contains the elements of a CMTime structure
98 representing the amount of time the phone has been running since the last
99 boot, not including standby time.
100 },
101 timescale => { Name => 'RunTimeScale' }, # (seen 1000000000 --> ns)
102 epoch => { Name => 'RunTimeEpoch' }, # (seen 0)
103 value => { Name => 'RunTimeValue' }, # (should divide by RunTimeScale to get seconds)
104 flags => {
105 Name => 'RunTimeFlags',
106 PrintConv => { BITMASK => {
107 0 => 'Valid',
108 1 => 'Has been rounded',
109 2 => 'Positive infinity',
110 3 => 'Negative infinity',
111 4 => 'Indefinite',
112 }},
113 },
114);
115
116# Apple composite tags
117%Image::ExifTool::Apple::Composite = (
118 GROUPS => { 2 => 'Camera' },
119 RunTimeSincePowerUp => {
120 Require => {
121 0 => 'Apple:RunTimeValue',
122 1 => 'Apple:RunTimeScale',
123 },
124 ValueConv => '$val[1] ? $val[0] / $val[1] : undef',
125 PrintConv => 'ConvertDuration($val)',
126 },
127);
128
129# add our composite tags
130Image::ExifTool::AddCompositeTags('Image::ExifTool::Apple');
131
132
1331; # end
134
135__END__
136
137=head1 NAME
138
139Image::ExifTool::Apple - Apple EXIF maker notes tags
140
141=head1 SYNOPSIS
142
143This module is loaded automatically by Image::ExifTool when required.
144
145=head1 DESCRIPTION
146
147This module contains definitions required by Image::ExifTool to interpret
148Apple maker notes in EXIF information.
149
150=head1 AUTHOR
151
152Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com)
153
154This library is free software; you can redistribute it and/or modify it
155under the same terms as Perl itself.
156
157=head1 SEE ALSO
158
159L<Image::ExifTool::TagNames/Apple Tags>,
160L<Image::ExifTool(3pm)|Image::ExifTool>
161
162=cut
Note: See TracBrowser for help on using the repository browser.