1###########################################################
2# A Perl package for showing/modifying JPEG (meta)data.   #
3# Copyright (C) 2004,2005,2006 Stefano Bettelli           #
4# See the COPYING and LICENSE files for license terms.    #
5###########################################################
6
7###########################################################
8# This file contains only the package man-page in perldoc #
9# format. In order to visualise it, it is sufficient to   #
10# type "perldoc <name_of_this_file>".                     #
11###########################################################
12
13=head1 NAME
14
15Image::MetaData::JPEG::MakerNotes - This document contains random
16information and details on MakerNotes; it is an appendix to the main manual
17page of the L<Image::MetaData::JPEG> module, which the reader should refer
18to for further details and the general scope. The note on L<MakerNote
19parsing|Image::MetaData::JPEG/On the problem of MakerNote corruption and
20ways to overcome it> in the main manual page is of particular interest.
21
22=head1 Pieces of information available after parsing the MakerNote
23
24The result of the process of parsing the maker note is stored in a
25directory in the internal data structure for the APP1 Segment, whose path
26is "IFD@SubIFD@MakerNoteData_$format", where $format is the specific note
27format; the 'MakerNote' entry in IFD0@SubIFD is then removed. This
28translation happens always, because there is a catch-all 'unknown' rule for
29a binary makernote with very broad acceptance rules. The maker note
30directory contains, in addition, a special subdir with some fields
31reporting about the parsing process.
32
33    key         content
34    --------    -------
35    ORIGINAL    the raw content of the maker note (unparsed)
36    SIGNATURE   the first few bytes which allowed the format to be chosen
37    ENDIANNESS  the byte order chosen during parsing
38    FORMAT      the maker note format chosen during parsing
39    ERROR       [optional] error details, in case of failure while parsing
40
41=head1 Supported MakerNote formats
42
43Maker note formats are specified in a special internal hash, with a key for
44each format (including the 'unknown' format). Each format entry corresponds
45to an anonymous hash containing information for parsing the MakerNote; the
46"normal" format is considered to be an IFD-like MakerNote with a next_link
47pointer, offsets counted from the global TIFF header and no MakerNote
48internal TIFF header.
49
50        key         meaning or effect
51        ---------   -----------------
52        signature   the MakerNote signature (a regular expression)
53        maker       the Maker signature (i.e., its name, no regex)
54        tags        a reference to a hash for tag translations
55    (A) mkntstart   if set, offsets are counted from the maker note start
56    (B) mkntTIFF    if set, offsets are counted from the internal TIFF header
57    (C) ignore      if set, the format is to be ignored
58    (D) nonext      if set, the maker note IFD does not have a next_link
59    (E) endianness  if set, the byte order is fixed to this value
60    (F) nonIFD      if set, the maker note is not IFD-like
61
62Currently, "supported" formats are described in the following table;
63authoritative data is indeed kept in Tables_makernotes.pl, to which the
64reader should refer for tag definitions and translations. Remember that
65both the 'signature' and the 'maker' fields are regular expressions
66matching at the beginning (the real signature corresponds to $1).
67
68                A B C D E F Maker     Signature
69		----------- --------- -----------------
70    Agfa                    AGFA      (AGFA \000\001)
71    Canon                   Canon     ()
72    Casio_1                 CASIO     ()[^Q]
73    Casio_2                 CASIO     (QVC\000{3})
74    Epson                   EPSON     (EPSON\000\001\000)
75    Foveon                  FOVEON    (FOVEON\000{2}\001\000)
76    Fujifilm    x           FUJIFILM  (FUJIFILM\014\000{3})
77    HPackard        x       Hewlett-Packard    (HP)
78    Kyocera     x     x     KYOCERA   (KYOCERA {12}\000{3})
79    Kodak               B x KODAK     (KDK INFO[a-zA-Z0-9]*  )
80    Minolta_1               MINOLTA   ().{10}MLT0
81    Minolta_2               Minolta   ().{10}MLT0
82    Konica          x       Minolta|KONICA ((MLY|KC|(\+M){4})|\001\000{5}\004)
83    Nikon_1                 NIKON     (Nikon\000\001\000)
84    Nikon_2                 NIKON     ()[^N]
85    Nikon_3       x         NIKON     (Nikon\000\002[\020\000]\000{2})
86    Olympus                 OLYMPUS   (OLYMP\000[\001\002]\000)
87    Panasonic_1       x     Panasonic (Panasonic\000{3})
88    Panasonic_2     x x     Panasonic (MKED)
89    Pentax_1    x           Asahi     ()[^A]
90    Pentax_2    x     x     Asahi     (AOC\000..)
91    Ricoh_1         x       RICOH     (Rv|Rev)
92    Ricoh_2         x       RICOH     (\000)
93    Ricoh_3                 RICOH     ((Ricoh|RICOH)\000{3})
94    Sanyo                   SANYO     (SANYO\000\001\000)
95    Sigma                   SIGMA     (SIGMA\000{3}\001\000)
96    Sony              x     SONY      (SONY (CAM|DSC) \000{3})
97    Toshiba         x       TOSHIBA   ()
98    unknown             x   .         ()
99
100=head1 References
101
102MakerNote format details are not usually released by vendors (well, this is
103an euphemism: no vendor ever, to my knowledge, released any detail on its
104format, exception made for Sigma/Foveon). All information used for this
105package was collected on the Internet (and its reliability is therefore
106limited) or through personal tests. Some interesting sites are (not an
107exhaustive list at all):
108
109  General:   home.arcor.de/ahuggel/exiv2/makernote.html
110    .....:   www.ozhiker.com/electronics/pjmt/jpeg_info/makernotes.html
111
112  Agfa:      www.ozhiker.com/electronics/pjmt/jpeg_info/agfa_mn.html
113  Canon:     www.burren.cx/david/canon.html
114  Casio:     park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
115    ...:     www.dicasoft.de/casiomn.htm
116  Epson:     www.ozhiker.com/electronics/pjmt/jpeg_info/epson_mn.html
117  Foveon:    Foveon is the same as Sigma, see Sigma
118  Fujifilm:  park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
119    ......:  www.ozhiker.com/electronics/pjmt/jpeg_info/fujifilm_mn.html
120  Kyocera:   www.ozhiker.com/electronics/pjmt/jpeg_info/kyocera_mn.html
121  Kodak:     my personal tests with my Kodak DX3900 (not IFD-like)
122  Minolta:   www.dalibor.cz/minolta/makernote.htm
123    .....:   www.ozhiker.com/electronics/pjmt/jpeg_info/minolta_mn.html
124  Nikon:     park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
125    ...:     www.tawbaware.com/990exif.htm
126    ...:     www.ozhiker.com/electronics/pjmt/jpeg_info/nikon_mn.html
127  Olympus:   park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
128    .....:   www.ozhiker.com/electronics/pjmt/jpeg_info/olympus_mn.html
129  Panasonic: www.compton.nu/panasonic.html
130  Pentax:    www.ozhiker.com/electronics/pjmt/jpeg_info/pentax_mn.html
131  Ricoh:     www.ozhiker.com/electronics/pjmt/jpeg_info/ricoh_mn.html
132  Sanyo:     www.exif.org/makernotes/SanyoMakerNote.html
133  Sigma:     www.x3f.info/technotes/FileDocs/MakerNoteDoc.html
134  Sony:      www.ozhiker.com/electronics/pjmt/jpeg_info/sony_mn.html
135
136=head1 DX3900 MakerNote format
137
138Kodak MakerNotes are written in a proprietary binary format, which is not
139IFD-like. So, there is no way to detect the beginning, end and type of a
140field; everything here was inferred through a careful comparison of the
141content of a set of Kodak JPEG files and their shot parameters. Fields
142seems to be aligned on four bytes boundaries. For the DX3900 model the
143endianness is always fixed to big endian. The signature regular expression
144is "^(KDK INFO[a-zA-Z0-9]* )", the maker is 'KODAK'. The meaning of the
145tags is as follows:
146
147  BYTE   ???                firmware version? This is always 3
148  BYTE   Compression        1 = normal, 2 = 2160x1440 high compression
149  BYTE   BurstMode          0 = off,    1 = on
150  BYTE   MacroMode          0 = normal, 1 = close-up
151  SHORT  PixelXDimension    \ allowed     2160x1440, 1800x1200,
152  SHORT  PixelYDimension    /     values: 1536x1024, 1080x720
153  SHORT  Year               the year value, with four digits
154  BYTE   Month              the month value  (in [1,12])
155  BYTE   Day                the day value    (in [1,31])
156  BYTE   Hour               the hour value   (in [0,23])
157  BYTE   Minute             the minute value (in [0,59])
158  BYTE   Second             the second value (in [0,59])
159  BYTE   SubSecond          (in 130th of seconds?)
160  SHORT  ???                ???
161  BYTE   ???                ???
162  BYTE   ShutterMode        0 = auto, 32 = manual
163  BYTE   MeteringMode       0 = multi-pattern, 1=centre weight., 2=centre spot
164  BYTE   BurstSequenceIndex index in [1,8], 0 if burst mode off
165  SHORT  FNumber            100 times the Exif F-number
166  LONG   ExposureTime       in 10^-5 seconds
167  SSHORT ExposureBiasValue  1000 times the exposure bias in [-2,+2 step .5]
168  SHORT  ???                ???
169  LONG   ???                \
170  LONG   ???                 \ is this an estimate of the subject
171  LONG   ???                 / distance? If so, it is very rough.
172  LONG   ???                /
173  BYTE   FocusMode          0 = auto, 2 = close, 3 = infinity
174  BYTE   ???                always 2
175  SHORT  ???                ???
176  SSHORT PanoramaMode       0 = normal, -1 = focus at infinity
177  SHORT  SubjectDistance    (x-28)*2.54+7 looks like the distance in cm
178  BYTE   WhiteBalance       0 = normal, 1 = fluor., 2 = tungsten, 3 = daylight
179  (27 bytes with unknown meaning here)
180  BYTE   FlashMode          0 = auto, 1 = on, 2 = off, 3 = red-eyes
181  BYTE   FlashFired         0 = yes,  1 = no
182  SHORT  ISOSpeedMode       the requested speed in {100,200,400} or zero
183  SHORT  ???                ???
184  SHORT  TotalZoomFactor    100 times the zoom factor in [+1,+6 step 0.1]
185  SHORT  DateTimeStampMode  0 = none, [1,6] = the six modes
186  SHORT  ColourMode         1 = black & white, 2 = sepia, 32 = colour
187  SHORT  DigitalZoomFactor  100 times the zoom factor in [+1,+3 step 0.1]
188  BYTE   ???                always zero
189  SBYTE  Sharpness          0 = standard, 1 = sharp, -1 = soft
190  (808 bytes with unknown meaning here, maybe a thumbnail?)
191
192=head1 AUTHOR
193
194Stefano Bettelli, B<bettelli@cpan.org>
195
196=head1 COPYRIGHT AND LICENSE
197
198Copyright (C) 2004,2005,2006 by Stefano Bettelli
199
200This library is free software; you can redistribute it and/or modify it
201under the terms of the GNU L<General Public License|perlgpl>. See the
202COPYING and LICENSE file for the license terms.
203
204=head1 SEE ALSO
205
206The main documentation page for the L<Image::MetaData::JPEG> module.
207
208=cut
209
210### Local Variables: ***
211### mode:perl ***
212### fill-column:75 ***
213### ispell-dictionary: "british" ***
214### End: ***
215