Debian Codegraph @

Changes

raw
1 0.159 2015-05-11 Ricardo Signes <[email protected]>
2
3 - deal with >4b APP0 (thanks, isync!)
4 - add metadata to distribution
5 - clean up pod abstracts
6
7 2014-05-12 Ricardo Signes <[email protected]>
8
9 * avoid useless use of ? modifier on fixed-length {n} repetition
10 in regex; avoids a warning in 5.20.0
11
12 2014-02-04 Ricardo Signes <[email protected]>
13
14 * avoid having output corrupted by assignment to $,
15
16 2014-02-02 Ricardo Signes <[email protected]>
17
18 * only run Pod::Checker tests when releasing
19 * encode all source at UTF-8, including comments
20 * add =encoding directives to Pod where needed
21
22 2009-06-18 Stefano Bettelli <[email protected]>
23
24 * lib/Image/MetaData/JPEG.pm: setting $VERSION to 0.153, and
25 posting to CPAN (this is mainly a bugfix version, being up-
26 loaded after three years due to lack of interest from users).
27 ==========================================================
28 Most relevant changes from version 0.15 to 0.152:
29 (see the documentation in the .pod files for more details)
30 ==========================================================
31 * eliminated all annoying errors in the test suite.
32 * added t/test_setup.pl to the MANIFEST (sorry version 0.151)
33 * updated Test::More related code (sorry version 0.152)
34 * fixed bug #17835 (see rt.cpan.org)
35 * new documentation: 'Structure of an XMP APP1 segment'
36 * new documentation: 'XMP data ("APP1" segments)'
37 * new (very preliminary) subsystem for parsing XML data
38 * new possibilities for the APP13 signature ('8BPS', 'PHUT').
39 Parser, dumper, tables and documentation changed accordingly.
40 * general reorganisation of files in the project.
41
42 2009-06-16 Stefano Bettelli <[email protected]>
43
44 * t/*.t: these tests were all failing due to some change
45 (that happened approximately two years ago) in the way
46 module symbols are imported by Test::More::use_ok.
47 I have moved some input code into a common file named
48 t/test_setup.pl.
49
50 2006-05-14 Stefano Bettelli <[email protected]>
51
52 * saved as version 0.15a and sent to Martin for comments.
53
54 * t/JPEG_4_app13.t: changed $APP13_PHOTOSHOP_DIRNAME into
55 $APP13_PHOTOSHOP_DIRNAME.'_8BIM'.
56
57 * lib/Image/MetaData/JPEG/access/app13.pl (sanitise_what): updated
58 list of allowed values for $what: 'IPTC', 'IPTC_2', 'IPTC_1',
59 'PHOTOSHOP', 'PS_8BIM', 'PS_8BPS' and 'PS_PHUT'.
60 (subdir_name): updated to return the new $what --> subdir corresp.:
61 'IPTC' => $APP13_IPTC_DIRNAME . '_2' # synonym
62 'IPTC_1' => $APP13_IPTC_DIRNAME . '_1'
63 'IPTC_2' => $APP13_IPTC_DIRNAME . '_2'
64 'PHOTOSHOP' => $APP13_PHOTOSHOP_DIRNAME . '_8BIM' # synonym
65 'PS_8BIM' => $APP13_PHOTOSHOP_DIRNAME . '_8BIM'
66 'PS_8BPS' => $APP13_PHOTOSHOP_DIRNAME . '_8BPS'
67 'PS_PHUT' => $APP13_PHOTOSHOP_DIRNAME . '_PHUT'
68 (get_app13_data): updated, so that, if $what is "non-IPTC", the
69 "extra" values for each record are appended, according to the tag.
70 I.e., use "if ($what!~/IPTC/)" instead of "if ($what eq 'PHOTOSHOP')".
71 (set_app13_data): same thing, when testing for "non-IPTC"-ness.
72 (insert_accepted): same thing, when testing for "non-IPTC"-ness.
73 (value_is_OK): same thing, when testing for "non-IPTC"-ness.
74
75 * lib/Image/MetaData/JPEG.pod: section "Photoshop and IPTC data
76 - ("APP13" segments)" modified to introduce new $what values:
77 Recent versions of Photoshop (>= 4.0) use a resource data block
78 type equal to '8BIM', and this is the default in this module (so,
79 'PHOTOSHOP' and 'PS_8BIM' are synonyms). However, some other older
80 or undocumented resource data block types are also allowed. Currently
81 allowed valuse are: 'PS_8BIM'='PHOTOSHOP', 'PS_8BPS' and 'PS_PHUT'.
82 See also allowed $what values in section "How to inspect and modify
83 your Photoshop data".
84
85 * lib/Image/MetaData/JPEG/dumpers/app13.pl (dump_app13): update to
86 cope with the new structure of APP13 for non-IPTC (Photoshop) data.
87 Now, all non-IPTC subdirs, named "${APP13_PHOTOSHOP_DIRNAME}_${type}"
88 for $type in @$APP13_PHOTOSHOP_TYPE, are searched in sequence and
89 dumped via $this->dump_resource_data_block ($type is a new argument).
90 The dump sequence for IPTC data was also simplified a bit.
91 (dump_resource_data_block): the Photoshop resource data block
92 type (sometimes named OS_type) is no more fixed to '8BIM', but
93 is passed in the second argument. If it is missing, it defaults
94 to $$APP13_PHOTOSHOP_TYPE[0], that is '8BIM', as before.
95
96 * lib/Image/MetaData/JPEG/parsers/app1_xmp.pl (parse_rdf_description):
97 some top-level rdf:Description's are there as placeholders (there
98 is only an empty CONTENT before the closing tag). In this case,
99 the property-extraction stage must be skipped. The consequence is
100 that we will have a namespace entry under 'SCHEMAS' but no property
101 with that prefix under 'PROPERTIES'.
102
103 2006-05-11 Stefano Bettelli <[email protected]>
104
105 * lib/Image/MetaData/JPEG/data/Tables.pm : updated to take into
106 account the new location of non-IPTC tags in an APP13 segment:
107 my $JPEG_RECORD_NAME =
108 {APP1 => {%$HASH_APP1_ROOT, .....
109 APP13 => {$APP13_PHOTOSHOP_DIRNAME.'_8BIM' => $HASH_PHOTOSHOP_TAGS,
110 $APP13_PHOTOSHOP_DIRNAME.'_8BPS' => $HASH_PHOTOSHOP_TAGS,
111 $APP13_PHOTOSHOP_DIRNAME.'_PHUT' => $HASH_PHOTOSHOP_PHUT,
112 $APP13_IPTC_DIRNAME.'_1' => $HASH_IPTC_TAGS_1,
113 $APP13_IPTC_DIRNAME.'_2' => $HASH_IPTC_TAGS_2,},};
114 See also %$HASH_PHOTOSHOP_PATHINFO and %$HASH_PHOTOSHOP_GENERAL.
115
116 * lib/Image/MetaData/JPEG/data/Tables.pm : the $APP13_PHOTOSHOP_TYPE
117 constant is now a reference to an array containing accepted strings
118 for a resource data block type. Currently, its value is the following:
119 $APP13_PHOTOSHOP_TYPE = ['8BIM', '8BPS', 'PHUT'];
120
121 * lb/Image/MetaData/JPEG/parsers/app13.pl (parse_resource_data_block):
122 The content of each Photoshop non-IPTC data block is transformed
123 into a record and stored in a first-level subdirectory, depending
124 on its type. The block type is, in fact, no more supposed to be
125 '8BIM'; however, only some known values are accepted. See the
126 variable $APP13_PHOTOSHOP_TYPE in Tables.pm
127
128 * lib/Image/MetaData/JPEG/Structures.pod: new note on resource
129 data block types in APP13, claryfing that 8BIM is only the default:
130 "The signature (type) is usually '8BIM', but Photoshop used '8BPS'
131 up to version 3.0, and some rogue program (Adobe PhotoDeluxe?) is
132 using 'PHUT' for path information (ID=7d0-bb7)."
133
134 2006-04-29 Stefano Bettelli <[email protected]>
135
136 * lib/Image/MetaData/JPEG/dumpers/dumpers.pl: the content of this
137 file is now broken down into separate pieces, which are 'require'd
138 here (that is, included): app1.pl, app1_exif.pl, app13.pl.
139
140 * lib/Image/MetaData/JPEG/parsers/parsers.pl: the content of this
141 file is now broken down into separate pieces, which are 'require'd
142 here (that is, included): image.pl, app0.pl, app1.pl, app1_exif.pl,
143 app1_exif_xmp.pl, app2.pl, app3.pl, app12.pl, app13.pl, app14.pl.
144
145 * lib/Image/MetaData/JPEG.pm: general reorganisation of files in
146 the project. New subdirs 'data', 'parsers', 'dumpers' and 'access'
147 created under 'JPEG'. The following use statements updated all
148 over the project (prefix is always Image::MetaData::JPEG::) :
149 Tables --> data::Tables
150 Tables_makernotes.pl --> data/Makernotes.pl
151 Segment_parsers.pl --> parsers/parsers.pl
152 Segment_dumpers.pl --> dumpers/dumpers.pl
153 JPEG_various.pl --> access/various.pl
154 JPEG_comments.pl --> access/comments.pl
155 JPEG_app1_exif.pl --> access/app1_exif.pl
156 JPEG_app13.pl --> access/app13.pl
157
158 2006-04-09 Stefano Bettelli <[email protected]>
159
160 * lib/Image/MetaData/JPEG/Tables.pm: new constants:
161 $APP1_XMP_XPACKET_ID = 'W5M0MpCehiHzreSzNTczkc9d'
162 $APP1_XMP_XPACKET_BEGIN = "\x{FEFF}"
163 $APP1_XMP_META_NS = 'adobe:ns:meta/'
164 $APP1_XMP_OUTER_RDF_NS = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
165 TagsAPP1 was broken into TagsAPP1_Exif and TagsAPP1_XMP.
166 Relevant changes applied to JPEG_app1_exif.pl,
167 Segment_dumpers.pl and Segment_parsers.pl.
168
169 2006-04-08 Stefano Bettelli <[email protected]>
170
171 * lib/Image/MetaData/JPEG/Structures.pod: completed syntax
172 description for the structure of an APP1 XMP segment.
173
174 2006-04-01 Stefano Bettelli <[email protected]>
175
176 * lib/Image/MetaData/JPEG/Structures.pod: added a new section
177 with title 'Structure of an XMP APP1 segment'.
178
179 * lib/Image/MetaData/JPEG.pod: started a new section with title:
180 'XMP data ("APP1" segments)', containing a very short description
181 of what is XMP and how it is used in JPEG files.
182
183 * t/JPEG_2_JPEG_class.t: explicit initialisation to "" of scalars
184 whose reference is passed to JPEG::save (see bug #17835). Same
185 change for t/JPEG_5_exif_Thumbnail.t, t/JPEG_5_exif_SubIFD.t,
186 t/JPEG_5_exif_GPS.t, t/JPEG_5_exif_IFD.t, t/JPEG_5_exif_IMAGE.t,
187 t/JPEG_5_exif_Interop.t, t/JPEG_4_app13_set.t, t/JPEG_3_comments.t
188
189 2006-03-27 Stefano Bettelli <[email protected]>
190
191 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_app1_xmp): new
192 routine for parsing XML data. This is more clean and logical, I
193 hope. It uses parse_xml_string() internally. Comments to be added.
194
195 2006-02-28 Stefano Bettelli <[email protected]>
196
197 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (set_Exif_thumbnail):
198 explicitely initialise $r to an empty string. See bug #17835 on
199 rt.cpan.org concerning Image::MetaData::JPEG. Thanks to Brian Carp
200 for the related discussion. Other changes still to implement.
201
202 2006-01-06 Stefano Bettelli <[email protected]>
203
204 * lib/Image/MetaData/JPEG.pm: setting $VERSION to 0.15, and
205 posting to CPAN (as soon as my network connection is working).
206 ==========================================================
207 Most relevant changes from version 0.141 to 0.15:
208 (see the documentation in the .pod files for more details)
209 ==========================================================
210 * IPTC data treatment in APP13 segments extended to deal with more
211 exotic IPTC record numbers (i.e., other than 2). IPTC setters and
212 getters (set/get_app13_data) updated to allow for the insertion of
213 datasets with record number = 1; this provides low level support
214 for coded character sets (e.g., Unicode strings in IPTC).
215 * Thumbnail replacement via set_Exif_data() made easier; a JPEG
216 object reference is now accepted as an alternative to a scalar
217 reference to a (valid) JPEG stream.
218 * Check on the segment length being valid moved to update(). This
219 anticipates the error condition at the time data is set, not at
220 the time data are written on disk.
221 * Revised rules for accepted and rejected dates (years). 'DateTime',
222 'DateTimeOriginal', 'DateTimeDigitized', 'GPSDateStamp', as well
223 as 'DigitalCreationDate', 'ReleaseDate' and 'ExpirationDate'
224 can be set to a date >= 1800AD. The IPTC 'DateCreated' dataset
225 accepts the full ISO-8601 YYYY-MM-DD format (from 0AD on).
226 * update() is called only once with 'IMAGE_DATA' in set_Exif_data.
227 * Bugfix: the standard value for 'XResolution' and 'YResolution'
228 is [72, 1], not [1, 72] as before.
229 * Documentation updates: more documentation on canonical IFD0 and
230 IFD1 tags, on DX3900 Makernotes, on Image::ExifTool capabilities,
231 more documentation and tests on IPTC and APP13, more examples in
232 the main .pod file.
233
234 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (set_Exif_data): new,
235 strictly private, argument (4th). If set, the update() routine is
236 not called. It is used by set_Exif_data() itself when called with
237 $action eq 'IMAGE_DATA', so that update() can be called only once.
238
239 * t/JPEG_5_exif_IMAGE.t: added a new test to check that update()
240 is really called only once when $action is 'IMAGE_DATA'.
241
242 2006-01-05 Stefano Bettelli <[email protected]>
243
244 * lib/Image/MetaData/JPEG/TagLists.pod: notes added to the "Canonical
245 Exif 2.2 and TIFF 6.0 tags for IFD0 and IFD1" section. Clarifications
246 for 'DateTime', 'DateTimeOriginal', and 'DateTimeDigitized' added.
247
248 * copyright extended to 2006 in all relevant files.
249
250 * moved to Vienna.
251
252 2005-12-18 Stefano Bettelli <[email protected]>
253
254 * saved as version 0.141c and sent to D.Manpearl for comments.
255
256 * lib/Image/MetaData/JPEG.pod: new example on how to display all
257 items from a repeatable IPTC record (under get_app13_data).
258
259 * lib/Image/MetaData/JPEG.pod: the documentation of set_Exif_data
260 now explains the new way to deal with thumbnails. There is also an
261 example of how to set and delete a thumbnail.
262
263 * t/JPEG_5_exif_Thumbnail.t: two set_Exif_data calls changed: the
264 argument is now a reference to a JPEG object. This tests the
265 previous modification for set_Exif_thumbnail.
266
267 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (set_Exif_thumbnail):
268 the argument can now be a reference to an Image::MetaData::JPEG
269 object. In this way, if you want to set a thumbnail from an already
270 existing object you don't need to extract the stream yourself.
271 Thanks to David Manpearl for suggestions on this interface.
272
273 2005-10-26 Stefano Bettelli <[email protected]>
274
275 * saved as version 0.141b and sent to Martin for comments.
276
277 * lib/Image/MetaData/JPEG.pod: section on update() updated.
278
279 * lib/Image/MetaData/JPEG/Segment_dumpers.pl: trivial modifications
280 in some routines. Specialised dumpers now return 'undef' when there
281 are no problems and a message when there is a problem.
282
283 * lib/Image/MetaData/JPEG/Segment.pm (update): this method now
284 saves a reference to the old segment data area and restores it if
285 the specialised update routine fails. This only generate a warning!
286 Are there cleverer ways to handle this case? It is however better
287 to have a corrupt object in memory, than a corrupt object written
288 over the original. Currently, this is restricted to the possibility
289 that an updated segment becomes too large, but all specialised
290 routines must nevertheless return 'undef' meaning there was no error.
291
292 * lib/Image/MetaData/JPEG/Segment.pm (set_data): the 'OVERWRITE'
293 option and the second argument are gone. This method can now be
294 used only to append new data to the segment data area. Blanking
295 the area must be a task for the general update() routine.
296 Appropriate changes to Segment_sumpers.pl applied.
297
298 * lib/Image/MetaData/JPEG/Tables.pm: new module variable for the
299 maximum length of the data area of a standard JPEG segment (this
300 does not apply to entropy-coded data and past-the-end "segments").
301 $JPEG_SEG_MAX_LEN = 2**16 - 3; exported via the JPEGgrammar tag.
302
303 2005-10-26 Stefano Bettelli <[email protected]>
304
305 * lib/Image/MetaData/JPEG/JPEG_app13.pl (set_app13_data): testing
306 explicitely for a dataset not being 'IPTC/NAA' is no more necessary.
307 Insertion of mandatory datasets much simplified and more robust.
308 (insert_accepted, screen_data): these new routines or methods
309 contain now some of the code previously belonging to set_app13_data,
310 which was really getting too big.
311
312 * lib/Image/MetaData/JPEG/JPEG_app13.pl (value_is_OK): don't test
313 whether $what is /^IPTC/ or not, just look for a syntax definition
314 for the tag. This makes the routine more robust. Skipping the test
315 on the second value for $what='PHOTOSHOP' is a bit hackish though.
316
317 * lib/Image/MetaData/JPEG/Tables.pm: syntax specifications added to
318 %$HASH_PHOTOSHOP_GENERAL. They are currently just placeholder, but
319 this could change in future. The only effect is to inhibit a direct
320 assignement of the 'IPTC/NAA' dataset, which must be modified with
321 specialised routines.
322
323 2005-10-25 Stefano Bettelli <[email protected]>
324
325 * saved as version 0.141a
326
327 * lib/Image/MetaData/JPEG.pod: prepared a clearer (?) and more
328 consistent SYNOPSIS (thanks to Julio Otuyama for this remark).
329
330 * lib/Image/MetaData/JPEG/TagLists.pod: trivial changes to
331 be consistent with the new rules on dates and centuries.
332
333 * t/JPEG_4_app13_IPTC.t: more tests on 'DigitalCreationDate',
334 'ReleaseDate', 'ExpirationDate', and expecially 'DateCreated'.
335 * t/JPEG_5_exif_GPS.t: more tests on 'GPSDateStamp'.
336 * t/JPEG_5_exif_IFD.t: more tests on 'DateTime'.
337 * t/JPEG_5_exif_SubIFD.t: more tests on 'DateTimeOriginal/Digitized'.
338
339 * lib/Image/MetaData/JPEG.pod: NOTES section added, with a
340 discussion on date setting and the notes on MakerNote corruption
341 which were previously written in MakerNotes.pod.
342
343 * lib/Image/MetaData/JPEG/Tables.pm: reorganisation of regular
344 expressions for date fields. The $re_year regular expression was
345 renamed to $re_yr18 and changed to '(18|19|20)\d\d'; this allows
346 'DateTime', 'DateTimeOriginal', 'DateTimeDigitized',
347 'GPSDateStamp', 'DigitalCreationDate', 'ReleaseDate' and
348 'ExpirationDate' to be set to a date from 1800AD on, and not from
349 1900AD as before. The IPTC 'DateCreated' dataset uses now a
350 different regular expression ($re_year = '\d{4}') which allows a
351 date in the full ISO-8601 YYYY-MM-DD format (from 0AD on). Have a
352 look at the note in the main pod document for further details.
353 Special thanks to Ian Cameron Smith for a long discussion on this
354 subject; however, I am still open to suggestions and
355 reconsiderations.
356
357 * lib/Image/MetaData/JPEG.pod: changed the description of
358 Image::ExifTool, which has write capabilities since early 2005.
359
360 * t/JPEG_4_app13_IPTC.t: some new tests for IPTC_1/IPTC_2 (800+!)
361
362 * t/JPEG_4_app13.t: some new tests for IPTC_1/IPTC_2
363
364 * lib/Image/MetaData/JPEG/Structures.pod: (very small) update
365
366 * lib/Image/MetaData/JPEG.pod: documentation updated for IPTC.
367
368 2005-10-24 Stefano Bettelli <[email protected]>
369
370 * lib/Image/MetaData/JPEG/JPEG_app13.pl (shift_non_repeatables):
371 new second argument $what, needed for retrieving syntax tables.
372 (value_is_OK): minimal changes to retrieve the correct syntax tables.
373 (set_app13_data): minimale changes to be ready for multiple IPTC
374 subdirectories; more systematic treatment of mandatory datasets.
375
376 * lib/Image/MetaData/JPEG/JPEG_app13.pl (provide_app13_subdir):
377 the initialisation of a subdirectory can include mandatory records,
378 which are now read from Tables.pm and not hardcoded here as it used
379 to be. The actual insertion is done via set_app13_data.
380
381 * lib/Image/MetaData/JPEG/JPEG_app13.pl (sanitise_what): $what can
382 be 'IPTC_2' (or 'IPTC' for back. compat.), 'IPTC_1' or 'PHOTOSHOP'.
383 (subdir_name): the correct subdirectory is returned for both
384 'IPTC_1' and 'IPTC_2' ('IPTC'): $APP13_IPTC_DIRNAME.'_1' or .'_2'
385
386 * lib/Image/MetaData/JPEG/Tables.pm: syntax tables and mandatory
387 records tables for IPTC data are now hidden in the corresponding
388 tag hashes, that is (for instance, for IPTC_1):
389 $$HASH_IPTC_TAGS_1{__syntax} = $HASH_IPTC_GENERAL_1;
390 $$HASH_IPTC_TAGS_1{__mandatory} = $HASH_IPTC_MANDATORY_1;
391
392 * lib/Image/MetaData/JPEG/Tables.pm (str2hex): "mandatory" datasets
393 my $HASH_IPTC_MANDATORY_1 = {'ModelVersion' => "\000\004" };
394 my $HASH_IPTC_MANDATORY_2 = {'RecordVersion' => "\000\002" };
395 I don't know why the standard says 4 for 'RecordVersion';
396 it turns out that you always find 2 in JPEG files.
397
398 2005-10-23 Stefano Bettelli <[email protected]>
399
400 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_IPTC_datasets):
401 modified to deal with IPTC record numbers other than 2. The record
402 number is now passed as first argument.
403
404 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_app13): modified
405 to cope with multiple IPTC records (in increasing numerical order).
406
407 * lib/Image/MetaData/JPEG/TagLists.pod: tag descriptions and notes
408 added for datasets in IPTC envelop records; the most important item
409 is the coded character set dataset, selecting the "alphabet".
410
411 * lib/Image/MetaData/JPEG/Tables.pm: changed HASH_IPTC_TAGS and
412 HASH_IPTC_GENERAL to take into account other IPTC records. This
413 is needed for supporting IPTC records different from two. Dataset
414 curriculum for record = 1 introduced in $HASH_IPTC_GENERAL_1.
415
416 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_IPTC_dataset):
417 this routine now takes one argument ($offset). $dirref is calculated.
418 Each dataset is saved in the corresponding record subdirectory.
419
420 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_IPTC_dataset):
421 new format for storing IPTC data. Given that I have found pictures
422 with records != 2, data-sets are now not all stored directly in the
423 $APP13_IPTC_DIRNAME = "IPTC_RECORD" directory, but in an appropriate
424 "${APP13_IPTC_DIRNAME}_${rnumber}", where $rnumber is the record
425 number (currently, only records 1 and 2 have been observed). Of
426 course, for most pictures only the IPTC_RECORD_2 subdirectory will
427 be populated. Obviously, the "IPTC record != 2 ..." error is now gone.
428 This implies a number of changes in other routines too ...
429
430 2005-08-16 Stefano Bettelli <[email protected]>
431
432 * t/test_photo.desc: changed the 'PanoramaMode' and 'Sharpness'
433 lines to SSHORT, to reflect the changes in Tables_makernotes.pl. I
434 guess I should run tests a bit more often ...
435
436 * lib/Image/MetaData/JPEG/Tables.pm: changed the 'XResolution' and
437 'YResolution' default values in $HASH_APP1_IFD01_MANDATORY to [72,
438 1]; tests updated (they were [1, 72], thanks to Ian Cameron Smith
439 for finding this error).
440
441 2005-04-09 Stefano Bettelli <[email protected]>
442
443 * lib/Image/MetaData/JPEG/MakerNotes.pod: new section on the
444 meaning of tag values for the DX3900 Kodak camera.
445
446 * lib/Image/MetaData/JPEG/Tables_makernotes.pl: 'PanoramaMode' for
447 Kodak cameras is now $SSHORT in '(0|-1)'; 'Sharpness' for Kodak
448 cameras is now $SBYTE in '(-1|0|1)'. Arbitrary but simpler ...
449
450 2005-03-21 Stefano Bettelli <[email protected]>
451
452 * lib/Image/MetaData/JPEG.pm: setting $VERSION to 0.141,
453 and posting to CPAN. This is only a minor bugfix release.
454 =================================================
455 Most relevant changes from version 0.14 to 0.141:
456 =================================================
457 * rt.cpan.org bug #11950 fixed
458 * Descriptions in documentation annexes fixed.
459
460 * lib/Image/MetaData/JPEG/Structures.pod: modify the description,
461 so that the first line contains the real description for this
462 document and not the note about it being an appendix. Same change
463 in TagLists.pod and MakeNotes.pod.
464
465 * t/JPEG_5_exif_GPS.t: a few tests added for correct limits on
466 longitudes and latitudes after closing the bug.
467
468 * lib/Image/MetaData/JPEG/Tables.pm: closing rt.cpan.org bug #11950,
469 "GPSLongitude field being dropped" (thanks to John Harvey). The
470 special rule for longitudes is not the same as that for latitudes,
471 because the limit is 180deg and not 90deg. Replaced $SSR_latlong
472 with $SSR_latitude (for 'GPSLatitude' and 'GPSDestLatitude') and
473 $SSR_longitude (for 'GPSLongitude' and 'GPSDestLongitude').
474
475 * lib/Image/MetaData/JPEG/TagLists.pod (GPS tags): Latitudes are
476 limited to the interval [0,90], while longitudes to [0,180].
477
478 2005-03-16 Stefano Bettelli <[email protected]>
479
480 * lib/Image/MetaData/JPEG.pm: setting $VERSION to 0.14, and posting
481 to CPAN. This should be in sync with next version of MaPiVi now.
482 ================================================
483 Most relevant changes from version 0.13 to 0.14:
484 ================================================
485 * New naming of top level keys in get_Exif_data when $what eq
486 'ALL' in get_Exif_data: the returned keys are now equal to $what.
487 * Implementation of MakerNote parsing; possibility to retrieve
488 MakerNote information via get_Exif_data (by setting $what eq
489 'MAKERNOTE_DATA'). However, the content is not currently modifiable.
490 * Prediction mechanism for semi-corrupted MakerNotes.
491 * New and more sensible algorithm for find_new_app_segment_position
492 * Better warning and error messages; ability to exclude warning
493 generation by setting $JPEG::show_warnings to undef.
494 * Older PhotoShop identifier accepted when parsing an APP13
495 segment (used by Photoshop version 2.5).
496 * Algorithm for skipping a few bogus bytes before a segment
497 marker (this bug is sometimes found after comment segments).
498 * Warning instead of error for prematurely terminating
499 JPEG streams (e.g. truncated files)
500 * New argument order for search_record/search_record_value:
501 the optional directory reference is now the last argument.
502 * Correction of a bug in Record::get_description corrected
503 (reference values were not printed correctly).
504 * New documentation section on the history of JPEG image file formats
505 * Script 'read_JPEG_metadata' added to distribution
506
507 2005-03-07 Stefano Bettelli <[email protected]>
508
509 * saved as version 0.13e (unless Martin finds bugs or asks for
510 changes, this will be next release, i.e. version 0.14).
511
512 * lib/Image/MetaData/JPEG.pod: ispell-ed
513 * lib/Image/MetaData/JPEG/MakerNotes.pod: ispell-ed
514
515 * lib/Image/MetaData/JPEG/Structures.pod: added a section on the
516 history of JPEG image file format standards + ispell-ed
517
518 * lib/Image/MetaData/JPEG.pm (parse_ecs): if the end of the
519 compressed stream is not found, complain but do not fail (similarly
520 to the 'xv' program); the file is however corrupt and unusable.
521
522 * lib/Image/MetaData/JPEG/Segment.pm (new): pay attention! the
523 first argument in the constructor (the old parental link) is now
524 gone. All relevant tests were updated: t/JPEG_1_segments.t,
525 t/JPEG_2_JPEG_class.t, t/JPEG_5_exif_IFD.t, t/JPEG_5_exif_IMAGE.t,
526 t/JPEG_5_exif_Interop.t, t/JPEG_5_exif_SubIFD.t,t/JPEG_2_rare.t;
527 new test count is 780.
528
529 * lib/Image/MetaData/JPEG/TagLists.pod: new note about SubIFD's
530 Pixel[XY]Dimension: this is the valid width or height of the
531 meaningful image (horizontal dimension does not include data
532 padding). Overall image dimensions can be read in the SOF
533 segment (this includes padding however).
534
535 * lib/Image/MetaData/JPEG.pod: removed paragraph on Segment's parent.
536 Modified SUBIFD_DATA's notes on 'PixelXDimension'/'PixelYDimension'
537 which now state: "Image dimensions can be retrieved from the SOF
538 segment with the JPEG structure object's method get_dimensions()
539 and set explicitely by the user (this cannot be done from within
540 the APP1 segment, because it does not link back to its parent);
541 however, the horizontal field in the SubIFD should not include data
542 padding, while that in the SOF segment does, so the meaning is a
543 bit different and these fields cannot be automatically calculated."
544
545 * lib/Image/MetaData/JPEG/Tables.pm ($HASH_APP1_SUBIFD_MANDATORY):
546 the default value of 'PixelXDimension' and 'PixelYDimension' is
547 now set to zero (this is a piece of information which only the
548 whole JPEG object can find, not a single segment; it must be set
549 by the user or by a JPEG object level method).
550
551 * lib/Image/MetaData/JPEG.pm: removed any trace of the "parental"
552 link in the Segment constructor. This avoids the problem of circular
553 references versus garbage collection and a lot of user level pain
554 just to set the image dimensions in a SubIFD starting from a segment.
555 Indeed, it seems it is the whole idea of having segments pointing
556 back to JPEG objects which is rotten: if a transformation requires
557 global knowledge, it is to be applied on a JPEG object. Same in:
558 lib/Image/MetaData/JPEG/JPEG_app13.pl (provide_app13_segment)
559 lib/Image/MetaData/JPEG/JPEG_app1_exif.pl(provide_app1_Exif_segment)
560 lib/Image/MetaData/JPEG/JPEG_comments.pl (add_comment)
561 lib/Image/MetaData/JPEG/JPEG_comments.pl (set_comment)
562 lib/Image/MetaData/JPEG/Segment.pm (info)
563 lib/Image/MetaData/JPEG/Segment.pm (new)
564
565 2005-02-28 Stefano Bettelli <[email protected]>
566
567 * saved as version 0.13d (sent to dalibor.cz, this is a condition
568 for being allowed to use Minolta MakerNote information).
569
570 * lib/Image/MetaData/JPEG/MakerNotes.pod: reformatted + some info
571 moved here from Tables_makernote.pl. Not yet the definitive MakerNote
572 resource in the world, but better than nothing ...
573
574 2005-02-16 Stefano Bettelli <[email protected]>
575
576 * saved as version 0.13c (release candidate 1 for 0.14); sent to
577 Martin for pre-release comments. MakerNotes.pod still to write ...
578
579 * t/JPEG_5_exif_Makernote.t: basic test file (44 tests) for
580 MakerNotes; this should be enough for this release. These tests
581 need a few supporting .jpg files (only the APP1 IFD0 is saved).
582 Their "weight" is only 9599 bytes.
583
584 2005-02-15 Stefano Bettelli <[email protected]>
585
586 * t/JPEG_2_JPEG_class.t: one more test on the correct behaviour
587 of find_new_app_segment_position in provide_app1_Exif_segment.
588
589 * t/JPEG_2_rare.t: added an APP13 with the old style identifier
590 'Adobe_Photoshop2.5:' into t/test_frankenstein.jpg, and a test
591 in JPEG_2_rare.t to be sure that it is read without errors.
592
593 * t/JPEG_2_rare.t: 10 new tests on JPEG::get_next_marker (skipping
594 a small amount of garbage, exiting on a large amount and no next
595 marker), on JPEG::parse_segments not trying to read past the end
596 of the file, and on the two new code snippets (unlink_segment and
597 link_segment) in JPEG.pod.
598
599 * lib/Image/MetaData/JPEG.pm (parse_segments): explicitely test that
600 there is enough data before reading the segment size and data.
601
602 * t/JPEG_1_segments.t: 5 new tests on the correct behaviour of
603 provide_subdirectory and search_record_value with respect to the
604 new approach of process_search_arguments.
605
606 * t/JPEG_0_records.t: 14 new tests on error generation in Record.pm.
607
608 * lib/Image/MetaData/JPEG/Record.pm (new): if the relevant argument is
609 not a reference, an error is generated (instead of returning silently).
610
611 * lib/Image/MetaData/JPEG/Record.pm (encode_integers): bug correction:
612 the condition of wrong endianness was not trapped correctly!
613
614 2005-02-14 Stefano Bettelli <[email protected]>
615
616 * lib/Image/MetaData/JPEG/MakerNotes.pod: this documentation file
617 is still to be reworked. It should contain (and expand) the comments
618 which are now disorderly written in JPEG/Tables_makernotes.pl.
619
620 * lib/Image/MetaData/JPEG.pod: documentation sync 0.13 --> 0.13b.
621
622 * lib/Image/MetaData/JPEG/Backtrace.pm ($show_warnings): assigned
623 $show_warnings to the JPEG package (although it is still physically
624 declared in the Backtrace package source file) so that it is more
625 easily addressed; modifications to: JPEG.pm, Segment.pm, Record.pm.
626 All relevant tests updated (they must refer to the new variable).
627
628 2005-02-13 Stefano Bettelli <[email protected]>
629
630 * saved as version 0.13b; documentation and tests still missing.
631
632 * lib/Image/MetaData/JPEG.pm (get_next_marker): modified to
633 be sure not to try to read past the end of the file.
634
635 * lib/Image/MetaData/JPEG/Tables.pm (JPEG_lookup): do not delete
636 the last element of the search path, even if it is false (some
637 tags can be zero).
638
639 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_app13): when
640 reading the identifier, don't try to read more bytes than available.
641
642 * t/JPEG_1_segments.t : tuned all existing tests (even in all
643 other .t files) to accept the previous changes. Most changes
644 consisted simply in regenerating t/test_photo.desc.
645
646 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_ifd): simmetrically,
647 the meaning of the last argument, which specifies how the next_link
648 pointer is to be treated, was changed ['0' --> the pointer is dumped
649 with a non zero value; '1' --> the pointer is dumped with value set
650 to zero; '2' -->: the pointer is ignored].
651
652 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_ifd_children):
653 transform the warning about 'Jumping back' into a real error.
654
655 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_interop): if
656 there is a remote data area, and the prediction mechanism is enabled,
657 use the prediction structure to set the value of $doffset; if the
658 mechanism is disabled, die if $doffset points before the first
659 prediction (this is very likely an address corruption).
660
661 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_ifd): the two
662 optional arguments are now to be interpreted in the following way:
663 the first one specifies how the next_link pointer is to be treated
664 ['0': the pointer is read; '1': the pointer is read and a warning
665 is issued if it is non-zero; '2': the pointer is not even read];
666 {parse_makernote() was changed accordingly}
667 the second one specifies whether the prediction mechanism for
668 interoperability offsets should be used or not. However, a three
669 element array is now always passed to parse_interop() for prediction,
670 with the following meaning: [0] = if set, use predictions to rewrite
671 addresses; [1] = value for next address prediction; [2] = old
672 interoperability array address.
673 {parse_interop() was changed accordingly}
674
675 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_ifd): take
676 no_next into account when calculating the first prediction: if
677 there is no next link, you must not add the last four bytes!
678
679 2005-02-12 Stefano Bettelli <[email protected]>
680
681 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_ifd): new argument
682 named next_link: 1 --> setup "next link" for another IFD, 0 --> setup
683 "next link" to zero, -1 --> do not even write the four "next link"
684 bytes (necessary for MakerNotes); dump_makernotes changed accordingly.
685
686 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (provide_app1_Exif_segment)
687 this function did not use the standard routine in JPEG.pm (i.e.,
688 find_new_app_segment_position) for choosing a position for a new
689 APP1 segment; its behaviour can now be standardised, given the
690 improved behaviour of JPEG::find_new_app_segment_position().
691
692 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_ifd): bug found
693 and corrected: when looking for thumbnail tags (location and length),
694 one must explicitely check that the IFD name is 'IFD1', since records
695 with the same tag (and different meaning) can be present in other
696 IFD's, for instance in the MakerNote.
697
698 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_app1_exif):
699 the identifier is now dumped directly by this routine, not by
700 dump_TIFF_header(), since it was decided that the identifier
701 is NOT part of the TIFF header.
702
703 * lib/Image/MetaData/JPEG/Record.pm (get_size): added a trap for
704 undefined types (this is only for debugging, obviously ...)
705
706 2005-02-11 Stefano Bettelli <[email protected]>
707
708 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_makernote) this
709 new routine is called by dump_ifd and is able to dump all kinds of
710 makernotes that parse_makernote was able to parse. If the MakerNote
711 scheme was unknown or there was an error at parse time, the MakerNote
712 is copied as-is (this implies no recalculation of offsets ...).
713
714 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_ifd): when
715 REFERENCE records are transformed back to offsets, only those records
716 with a non-undef extra field are to be considered (for MakerNotes).
717
718 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_makernote):
719 I changed my mind again: special MakerNote records are stored
720 in a subdir of the MakerNote directory, named like
721 'APP1@IFD0@SubIFD@MakerNoteData_Canon@special'.
722
723 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_TIFF_header):
724 relevant records are now searched for in the directory specified
725 by the second argument (extension for MakerNotes).
726
727 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_ifd): modified
728 to detect the presence of a MakerNote subdirectory and to delegate
729 its dump to a more specific routine (dump_makernote).
730
731 2005-02-10 Stefano Bettelli <[email protected]>
732
733 * lib/Image/MetaData/JPEG/Tables.pm (JPEG_lookup): generalised as
734 process_search_args: all undefined arguments are eliminated before
735 joining, and all empty elements are eliminated after splitting.
736 This makes the function much more robust (documentation?)
737
738 * lib/Image/MetaData/JPEG/Tables.pm ($HASH_APP1_SUBIFD_GENERAL):
739 editing of 'MakerNote' currently disabled (pseudo-regex set to
740 'invalid'); it will be probably re-enabled with a special $what,
741 like MAKERNOTE_DATA.
742
743 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (get_Exif_data): if the
744 current path is found to be invalid, it is given a second try assuming
745 the last part is just the beginning of a tag (this is needed for
746 MakerNote). One can now extract MakerNote information with $what set
747 to 'MAKERNOTE_DATA' (get_Exif_data automatically understands if the
748 correct subdir is MakerNoteData_Canon or MakerNoteData_Kodak or ...
749 Also: the numeric-to-textual translation is performed only for those
750 tags which are numeric (i.e., =~ /^\d+$/); because now we have text-
751 only tags outside the root subdir.
752
753 2005-02-09 Stefano Bettelli <[email protected]>
754
755 * lib/Image/MetaData/JPEG/Segment.pm (search_record): the returned
756 $record is initialised with a fake $REFERENCE record A pointing
757 to $this->{records}; so $this->search_record() returns A, and
758 $this->search_record_value() returns $this->{records}. This
759 should be added to the documentation!
760
761 * lib/Image/MetaData/JPEG/Segment.pm (process_search_args): no
762 arguments is now equivalent to (undef) instead of generating an
763 error; all undef or "false" arguments are simply discarded. So,
764 $this->provide_subdirectory() returns $this->{records}.
765
766 * lib/Image/MetaData/JPEG/Tables.pm (%IFD_SUBDIRS): changed my mind
767 again, the subdirectory corresponding to 'MakerNote' will be
768 'MakerNoteData', and will be specialised in 'MakerNoteData_format'.
769
770 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (get_Exif_data): the
771 first level keys in the hash returned by get_Exif_data when $what
772 is set to 'ALL' are now coincident with the sub-$what's, that is
773 'ROOT_DATA', 'IFD0_DATA', 'SUBIFD_DATA', ... instead of 'APP1',
774 'APP1@IFD0', 'APP1@IFD0@SubIFD', ... Documentation (both in .pod's
775 and in the code) is still to be updated!
776
777 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (%WHAT2IFD): prefix
778 'APP1' erased from values; setter/getter methods changed accordingly.
779
780 2005-02-08 Stefano Bettelli <[email protected]>
781
782 * lib/Image/MetaData/JPEG/Record.pm (get_description): changed the
783 sprintf format string from '%p' to '0x%06x' (really, I did not
784 understand what %p was about).
785
786 2005-02-07 Stefano Bettelli <[email protected]>
787
788 * lib/Image/MetaData/JPEG/Segment.pm (provide_subdirectory): extended
789 to mimick search_record's arguments treatment; this method looks for
790 a path of subdirectories from a given record list. All arguments are
791 joined to form a path specification, which is followed, and the last
792 directory (record list) is returned. An optional last argument may
793 specify an initial directory for the search ($this->{records} is the
794 defaults). If any subdir entry is not there, it is created on the fly.
795 Updated: parse_ifd, parse_makernote, build_IFD_directory_tree.
796
797 * lib/Image/MetaData/JPEG/Segment.pm (process_search_args): this
798 private method processes the arguments for search routines, like
799 search_record and provide_subdirectory. 1) a start directory is
800 chosen by looking at the last argument: if it is an ARRAY ref it
801 is popped out and used, otherwise the top-level directory (i.e.,
802 $this->{records}) is selected; 2) a $keystring is created by joining
803 all remaining arguments on '@', then this string is exploded into
804 a @keylist on the same character; 3) the start directory and the
805 @keylist is returned.
806
807 2005-02-06 Stefano Bettelli <[email protected]>
808
809 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_ifd): there is
810 now a prediction and correction mechanism for the offsets in the
811 interoperability arrays. The simple assumption is that the absolute
812 value of offsets can be wrong, but their difference is always right,
813 so, if you get the first one right ... a good bet is the address of
814 the byte immediately following the next_IFD link. This mechanism is
815 currently enabled only for MakerNotes (it might be able to read even
816 MakerNotes corrupted by an arbitrary relocation).
817
818 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_ifd_children):
819 the code for parsing sub-IFD's was single out into this routine.
820
821 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_makernote): this
822 routine was polished and uncommented; it now deals with every possible
823 MakerNote format (because of the catch-all rule), even if sometimes
824 it has a minimalist approach ... Information is made available in a
825 subdirectory of APP1@IFD@SubIFD, named 'MakerNote_' + the selected
826 format (so, there isn't any more any 'MakerNote' entry in IFD0@SubIFD);
827 this subdirectory contains all parsed fields plus some "artificial"
828 fields like 'ORIGINAL', 'SIGNATURE' and 'ERROR' (an human-readable
829 explanation, if a parsing problem occurred).
830
831 * lib/Image/MetaData/JPEG/Tables_makernotes.pl ($HASH_MAKERNOTES):
832 there is now a catch-all rule, a phantomatic binary makernote
833 with very broad acceptance rules ... named _Unknown. In this way,
834 all MakerNote data areas should be expanded into a subdirectory,
835 even if their existence is still unknown.
836
837 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_IPTC_dataset):
838 this routine now starts with a size test: we need to have at least
839 five bytes if the dataset header is to be read. This makes error
840 messages more informative.
841
842 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_app1_exif):
843 increased the tolerance for thumbnails smaller than declared
844 to 10 (I have now an example of a valid thumbnail which should
845 span 6352 bytes, but it spans only 6348 (= -4).
846
847 2005-02-05 Stefano Bettelli <[email protected]>
848
849 * lib/Image/MetaData/JPEG.pm (get_next_marker): an old version
850 of "Arles Image Web Page Creator" had a bug which caused the
851 application to generate JPEG's with illegal comment segments,
852 reportedly due to a bug in the Intel JPEG library the developers
853 used at that time (these segments had to 0x00 bytes appended). It
854 is true that a JPEG file with garbage between segments is to be
855 considered invalid, but some libraries like IJG's try to forgive,
856 so we try to forgive too, if the amount of garbage isn't too large ...
857
858 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_app13): updated
859 to dump the eight additional bytes for version 2.5
860
861 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_app13): adapted
862 to check for all identifier in @$APP13_PHOTOSHOP_IDS, and to read
863 some additional undocumented bytes (resolution info?) for version
864 2.5 only, now saved in a root 'Resolution' record.
865
866 * lib/Image/MetaData/JPEG/JPEG_app13.pl (provide_app13_segment):
867 use the first element of @$APP13_PHOTOSHOP_IDS as PhotoShop id
868 string, $APP13_PHOTOSHOP_IDENTIFIER is no more.
869 (is_app13_ok): just ask $id is found in @$APP13_PHOTOSHOP_IDS.
870
871 * lib/Image/MetaData/JPEG/Tables.pm ($APP13_PHOTOSHOP_IDS): people
872 they say this segment always starts with a specific string from
873 Adobe, namely "Photoshop 3.0\000". But some old pics, with only
874 non-IPTC data, use other strings ..., so now there is an array
875 of possible identifier (the first one is considered the default)
876
877 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_app13): do not
878 assume you know the value of the PhotoShop identifier, just read
879 it from the record list and complain if you don't find it.
880
881 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_TIFF_header):
882 the endianness is now changed locally, so it is restored when
883 this subroutine returns. Previously it was resetting to $BIG_ENDIAN
884 in any case, which is an error now that parse_TIFF_header is used
885 also during MakerNote parsing. Now, I am using 'local' in all
886 places where I used to save and restore the value manually.
887
888 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_TIFF_header):
889 this method was reworked, taking signature reading away and allowing
890 for alternative record directories to save results in. The first
891 argument is the start address of the TIFF header; the second one,
892 optional, is the record subdirectory where parsed records should
893 be saved (defaulting to the root dir). Obvious changes applied to
894 parse_makernote(), parse_app1_exif() and parse_app3().
895
896 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_app1_exif)
897 (parse_app3): once parsing is finished, it is better to set the
898 segment endianness to undefined, to catch errors.
899
900 2005-02-04 Stefano Bettelli <[email protected]>
901
902 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_ifd): same
903 thing, for the fifth argument ($offset_ref). Moreover, there is
904 no need to pass two offset bases ($tiff_base and $opt_offset_base):
905 it is sufficient to pass $offset = $link + $base as second argument
906 and only one offset base as secon argument (so, the final optional
907 argument is no more).
908
909 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_TIFF_header):
910 this method now returns only three arguments; the first one, which
911 corresponded to the offset of the first byte immediately after the
912 TIFF header, had no use and was therefore dropped.
913
914 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_makernote):
915 complete revision of this method which parses a MakerNote block and
916 writes all decoded information to a subdirectory named MakerNote_xxx
917 where xxx is a MakerNote format; this subdirectory contains some
918 special records: 'ORIGINAL', 'SIGNATURE', 'ENDIANNESS' and 'FORMAT',
919 and maybe 'ERROR', if there is some kind of failure. A lot of
920 comments added to the code. A bug in the secondary TIFF header
921 base was discovered and corrected (this concerns Martin's model!)
922
923 * lib/Image/MetaData/JPEG/Segment.pm: file inclusion is moved at the
924 end of the file (there is no need to do this in a BEGIN block). But
925 use Tables must use also qw(:Endianness :RecordTypes).
926
927 * lib/Image/MetaData/JPEG.pm: file inclusion is moved at the end
928 of the file (there is no need to do this in a BEGIN block).
929
930 * lib/Image/MetaData/JPEG/Tables_makernotes.pl: this new file contains
931 most MakerNote-related stuff. Basically, it creates $HASH_MAKERNOTES;
932 it MUST always be include by Tables.pm with a "do".
933
934 2005-02-03 Stefano Bettelli <[email protected]>
935
936 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_ifd): the
937 MakerNote records skipped by parse_interop() are analysed here with
938 a call to parse_makernote (which shares, however, a large amount of
939 pre-processing with recursive calls to parse_ifd).
940
941 * lib/Image/MetaData/JPEG/Tables.pm (%IFD_SUBDIRS): 'APP1@IFD0@SubIFD'
942 has now another entry mapping 'MakerNote' to 'MakerNote_'; this
943 allows Segment::parse_ifd to process a MakerNote entry as a special
944 type of sub-IFD (see also the log entry for parse_ifd).
945
946 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_interop): this
947 method is modified so that it intercepts a MakerNote Interoperability
948 array and stores it as one $LONG (instead of many $UNDEF bytes); the
949 MakerNote is processed at a later time. The size of the MakerNote
950 data area is saved in the extra field.
951
952 2005-02-02 Stefano Bettelli <[email protected]>
953
954 * lib/Image/MetaData/JPEG/Tables.pm ($MAKERNOTE_TAG): this new
955 variable corresponds to the MakerNote tag (0x927c) which can be
956 found in 'APP1@IFD0@SubIFD'; it is exported by :TagsAPP1.
957
958 * lib/Image/MetaData/JPEG/Record.pm (die, warn): explicitely test
959 that $this is a reference (it could be the package name, since there
960 are "static" methods in this class. Test added to t/JPEG_0_records.t.
961
962 2005-02-01 Stefano Bettelli <[email protected]>
963
964 * saved as version 0.13a (documentation is not yet updated from 0.13)
965
966 * COPYING: changed the copyright period from "2004" to "2004,2005"
967 for all relevant files in the distribution.
968
969 * t/JPEG_0_records.t: 4 tests added, checking for the implementation
970 of the warning/error report system (and the inhibition of warnings).
971
972 * lib/Image/MetaData/JPEG/Record.pm (die, warn): see (die, warn)
973 for the main package. Changed files: Record.pm [Record problems
974 do not cause warnings, they are all fatal ...]
975
976 * t/JPEG_1_segments.t: 4 tests added, checking for the implementation
977 of the warning/error report system (and the inhibition of warnings).
978
979 * lib/Image/MetaData/JPEG/JPEG_app13.pl (sanitise_*): this group of
980 routines is now implemented as a group of Segment methods, so that
981 it can use the warn/die mechanism of that package. Also, subdir_name
982 is now a subroutine, not a subroutine reference. All of these are
983 used only by the Segment class, which takes care to intercept errors
984 for higher level calls.
985
986 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (complement_records):
987 this function is now a Segment method, so that it can use the
988 warn/die mechanism of that package.
989
990 * lib/Image/MetaData/JPEG/Segment.pm (die, warn): see (die, warn)
991 for the main package. Changed files: Segment.pm, Segment_parser.pl,
992 Segment_dumpers.pl, JPEG_app1_exif,pl
993
994 * t/JPEG_2_rare.t: 4 tests added, checking for the implementation
995 of the warning/error report system (and the inhibition of warnings).
996 [this is the 700th test milestone!]
997
998 * lib/Image/MetaData/JPEG/JPEG_app13.pl (is_app13_ok): this
999 routine now dies if $what is invalid.
1000
1001 * lib/Image/MetaData/JPEG.pm (die, warn): these simple methods
1002 should be used instead of standard "warn" and "die" in this package;
1003 they print a much more elaborated error message (including a stack
1004 trace). Warnings can be turned off altogether simply by setting
1005 Image::MetaData::JPEG::Backtrace::show_warnings to false. The
1006 Image::MetaData::JPEG was updated to comply with these rules:
1007 this included modifications to JPEG.pm, JPEG_comments.pl and
1008 JPEG_app13.pl (in this file, all sanitise_* subs were moved to the
1009 JPEG::Segment section). Some error messages were reworked to take
1010 into account the fact that the subroutine name is already shown in
1011 the stack trace.
1012
1013 * lib/Image/MetaData/JPEG/Backtrace.pm ($show_warnings) this
1014 package variable must be used to inhibit the printing of
1015 warnings: if it is false, warnings are silently ignored.
1016
1017 * lib/Image/MetaData/JPEG/Backtrace.pm (backtrace): this is a private
1018 customisable function (in a separated private package) for creating
1019 an error (or warning) message with the current stack trace attached.
1020 It uses additional information returned by the built-in Perl function
1021 'caller' when it is called from within the 'DB' package (is this
1022 dangerous?). To be used by JPEG, JPEG::Segment, JPEG::Record ...
1023
1024 2005-01-31 Stefano Bettelli <[email protected]>
1025
1026 * t/JPEG_2_JPEG_class.t: changed for find_new_app_segment_position;
1027 also, added twelve new tests to check this method better.
1028
1029 * t/JPEG_4_app13.t: changed for find_new_app_segment_position
1030
1031 * lib/Image/MetaData/JPEG.pm (find_new_app_segment_position): the
1032 algorithm was reworked to be more sensible: the position is chosen
1033 immediately before the first (or after the last) element of some
1034 list, provided that the list is not empty, otherwise the next list
1035 is taken into account:
1036 -) [for COM segments only] try after 'COM' segments;
1037 otherwise try after all APP segments;
1038 -) [for APPx segments only] try after the last element
1039 of the list of APPy's (with y = x..0, in sequence);
1040 otherwise try before the first element of the list of
1041 APPy's (with y = x+1..15, in sequence);
1042 -) try before the first DHP segment
1043 -) try before the first SOF segment
1044 If all these approaches fail, the method returns the position
1045 immediately after the SOI segment (i.e., 1). The argument must be
1046 the name of the segment to be inserted (it defaults to 'COM',
1047 producing a warning).
1048 (insert_segments): pass the name of the first segment to be
1049 inserted to find_new_app_segment_position if this is to be called.
1050
1051 * lib/Image/MetaData/JPEG/TagLists.pod: now starting with:
1052 ------------------------------------
1053 =head1 NAME
1054
1055 Image::MetaData::JPEG::TagLists - This document is an appendix to ...
1056 ------------------------------------
1057 so that the POD-to-html translator on search.cpan.org will link
1058 it correctly. A similar change was applied to the other POD files
1059 in the JPEG/ directory. Thanks to <search-rt at cpan.org> and in
1060 particular to Graham Barr for directing me to the problem.
1061
1062 2005-01-16 Stefano Bettelli <[email protected]>
1063
1064 * lib/Image/MetaData/JPEG/Segment.pm (this is a clarification):
1065 $this->{parent} links to a parent entity (to which the Segment
1066 belongs) or is undef (if the Segment does not belong to any entity,
1067 i.e.,it is an orphan). The parent entity is supposed to know it
1068 owns the Segment, and a Segment must never be owned by two entities.
1069 If the link is changed, the old parent must be informed; if it is
1070 set to a non-undef value, the new parent must be informed as well,
1071 unless this happens in the ctor.
1072
1073 2004-12-15 Stefano Bettelli <[email protected]>
1074
1075 * t/JPEG_5_exif_IMAGE.t, t/JPEG_5_exif_IFD.t: added three tests in
1076 each file to be extra-sure DateTime is written and re-read correctly.
1077
1078 * ContentLocationCode, IPTC /[A-Z]{3}?/ --> /[A-Z]{3}/
1079
1080 2004-12-06 Stefano Bettelli <[email protected]>
1081
1082 * saved current version as Image-MetaData-JPEG-0.13, posted to CPAN.
1083 This is a bug-fixing release; corrections with respect to v.0.12 are:
1084 --) using 'REPLACE' on an IFD does not erase its sub IFD's;
1085 --) test of infinities and not-a-number's (more general regexps);
1086 --) ComponentsConfiguration, FileSource and SceneType records default
1087 values are now binary (they were erroneously strings);
1088 --) standard SubIFD tags now prevail over company-related ones;
1089 --) FlashEnergy, SpatialFrequencyResponse, FocalPlaneXResolution,
1090 FocalPlaneYResolution, FocalPlaneResolutionUnit, ExposureIndex,
1091 SensingMethod, CFAPattern can now be set only in SubIFD;
1092 --) improvements to documentation
1093
1094 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_interop):
1095 the MakerNote hook is commented out, because I need to commit
1096 a bug-fixing realease.
1097
1098 * lib/Image/MetaData/JPEG/MakerNotes.pod: added a discussion on
1099 the problem of MakerNote corruption in the MakerNote documentation.
1100
1101 * lib/Image/MetaData/JPEG.pod: added a note about the jhead
1102 program in the "OTHER PACKAGES" section (why was this missing?)
1103
1104 2004-12-01 Stefano Bettelli <[email protected]>
1105
1106 * lib/Image/MetaData/JPEG.pod: split the documentation into three
1107 distinct files, because it was becoming too long: JPEG.pod (usage
1108 and prototypes), JPEG/Structures.pod (general information about the
1109 structure of JPEG files) and JPEG/TagLists.pod (valid values for
1110 various numerical tags). There will be also a JPEG/MakerNotes.pod
1111 file containing MakerNote discussions only.
1112
1113 2004-11-25 Stefano Bettelli <[email protected]>
1114
1115 * saved as version 0.12b, sent to users for comments
1116
1117 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (set_Exif_data):
1118 terrible bugs today! Remeber that, even for $action eq REPLACE, we
1119 cannot delete all the records. We must preserve $REFERENCE records,
1120 otherwise the corresponding directories would be forgotten; we
1121 don't want that, for instance, SubIFD is deleted when the records
1122 of IFD0 are REPLACEd. Tests added to t/JPEG_5_exif_IFD.t. There is
1123 still a problem: how do we delete (sub)IFD's completely, e.g., the
1124 GPS IFD? This point must be addressed at a later stage.
1125
1126 * lib/Image/MetaData/JPEG/Tables.pm ($HASH_APP1_IFD01_COMPANIES):
1127 the following company-related fields are now marked as invalid
1128 because they are present also in the SubIFD section (with different
1129 numerical values) and I don't want the two entries to collide when
1130 setting IMAGE_DATA (thanks to Jody Harris for pointing me to the bug).
1131 Tests added to t/JPEG_5_exif_IMAGE.t
1132
1133 Record Name Tag in SubIFD Tag in IFD*
1134 -------------------------- ------------- -----------
1135 'FlashEnergy' 0xa20b 0x920b
1136 'SpatialFrequencyResponse' 0xa20c 0x920c
1137 'FocalPlaneXResolution' 0xa20e 0x920e
1138 'FocalPlaneYResolution' 0xa20f 0x920f
1139 'FocalPlaneResolutionUnit' 0xa210 0x9210
1140 'ExposureIndex' 0xa215 0x9215
1141 'SensingMethod' 0xa217 0x9217
1142 'CFAPattern' 0xa302 0x828e
1143
1144 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (set_Exif_data): when
1145 $what is 'IMAGE_DATA', try to insert first into SubIFD, then, into
1146 IFD0. This favours SubIFD standard tags in front of IFD company-
1147 related non-standard tags. For security reasons however, these
1148 non-standard tags are labelled as invalid in Tables.pm: this prevents
1149 them from being set but not from being recognised if present.
1150
1151 * lib/Image/MetaData/JPEG/Tables.pm ($HASH_APP1_SUBIFD_MANDATORY):
1152 the 'ComponentsConfiguration' mandatory record was erroneously set
1153 to '1230', but it is really "\001\002\003\000". Tests corrected.
1154 A detailed analysis of Tables.pm revealed that the 'FileSource'
1155 and 'SceneType' records suffered the same problem (also corrected).
1156
1157 2004-11-21 Stefano Bettelli <[email protected]>
1158
1159 * lib/Image/MetaData/JPEG/Record.pm (string_manipulator): the
1160 reworked string is written in a fixed length field only if the
1161 string was shortened (this avoids ugly trailing spaces). The
1162 t/test_photo.desc was updated.
1163
1164 2004-11-20 Stefano Bettelli <[email protected]>
1165
1166 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_interop): code
1167 refactoring and clarification. There is now a check that the data
1168 area of the Interoperability array (for $size's larger than 4)
1169 exists and has the correct size (this avoids trying to read it if
1170 the data area offset points out of the segment). Also, if $tag
1171 corresponds to a MakerNote, and we are in the correct SubIFD, the
1172 MakerNote parser is called.
1173
1174 2004-11-19 Stefano Bettelli <[email protected]>
1175
1176 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_ifd): new
1177 flexibility: if $no_next is -1, the "next IFD" link is not even
1178 read (and so, $$offset_ref advances four bytes less). In this case
1179 the final test about $no_next never fails. The "next IFD link" is
1180 sometimes missing in MakerNotes.
1181
1182 * saved as version 0.12a, sent to Martin for comments
1183
1184 * t/JPEG_p_podchecker.t: modified the POD tests; it now relies on
1185 the number of potential syntax problems returned by podchecker()
1186 instead of relying on the message generated by parse_from_file().
1187
1188 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_makernote):
1189 draft method for MakeNote parsing, this time it works better.
1190
1191 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_TIFF_header):
1192 there is now a second optional argument, specifying an offset
1193 pointing to the beginning of the desired TIFF structure, with
1194 default value 0. In normal Exif APP1 segments it is always zero,
1195 but this allows for some flexibility explited by MakerNote readers.
1196
1197 2004-11-18 Stefano Bettelli <[email protected]>
1198
1199 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_ifd): the
1200 reference address for offsets we are going to read is usually the
1201 TIFF base. But some MakerNotes use a different approach, so a new
1202 variable ($base) is introuduced allowing for a different base. The
1203 argument list of parse_ifd is now ($this, $dirnames, $link,
1204 $tiff_base, $offset_ref, $no_next, $base).
1205
1206 2004-11-17 Stefano Bettelli <[email protected]>
1207
1208 * lib/Image/MetaData/JPEG/Record.pm (get_description): the textual
1209 description for a tag not corresponding to a key of %$section_hash
1210 is now "?? Unknown record ??", not "?? Unknown record type ??";
1211 moreover, if the corresponding value is not defined the description
1212 becomes "?? Nameless record ??", not (this is new, and allows for
1213 more descriptive hashes in Tables.pm). Test files updated.
1214
1215 2004-11-03 Stefano Bettelli <[email protected]>
1216
1217 * lib/Image/MetaData/JPEG.pod: added a link (with L<...>) to the
1218 ExifTool script and the Image::ExifTool module by Phil Harvey,
1219 which are now on the CPAN archive.
1220
1221 * t/JPEG_0_records.t (tests on infinities and not-a-numbers):
1222 these tests are now implemented as case-insensitive pattern matches,
1223 because the strings printed for these special IEEE cases are
1224 system-dependent; e.g., 'inf' can become 'Inf' or 'Infinity' or
1225 '1.#INF'. I am currently matching against $notnums[$_], where
1226 @notnums = (qr/NAN/i, qr/^[^-]*INF/i, qr/-.*INF/i) (note the 'i',
1227 for case-insensitive match). Thanks to Jost Krieger, cpansmoker
1228 and the cpan-testers group for help in spotting this bug.
1229
1230 2004-11-02 Stefano Bettelli <[email protected]>
1231
1232 * saved current version as Image-MetaData-JPEG-0.12, posted to CPAN
1233
1234 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (set_Exif_thumbnail):
1235 this private method is called by set_Exif_data when the $what
1236 argument is set to 'THUMBNAIL'. $data must be a reference to a
1237 scalar value (undefined is an error!). First, we erase all thumbnail
1238 related records from IFD1 then we reinsert those which are appropriate.
1239 Last, the update method is called (this also fixes some fields).
1240 --> $$data eq '': nothing else to do, thumbnail erased.
1241 --> $$data equal to a JPEG stream: thumbnail data are saved in
1242 the root level directory, and a few records are added to IFD1:
1243 'JPEGInterchangeFormat' (offset), 'JPEGInterchangeFormatLength',
1244 and 'Compression' set to six (this indicates a JPEG thumbnail).
1245
1246 * lib/Image/MetaData/JPEG.pm (parse_segments): don't claim empty
1247 files are valid JPEG pictures; in this case, the method dies
1248 immediately. Saying what is a valid JPEG file is not easy ...
1249
1250 2004-11-01 Stefano Bettelli <[email protected]>
1251
1252 * saved as private version 0.11f
1253
1254 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (set_Exif_thumbnail):
1255 preliminary implementation of "set thumbnail". This allows to insert
1256 a JPEG thumbnail or to remove it (uncompressed thumbnails not yet
1257 supported, and it won't be easy).
1258
1259 * all save operations in test scripts rewritten so that they use
1260 in memory variables instead of writing to disk. The only real disk
1261 access is in t/JPEG_2JPEG_class.t for testing pourposes.
1262
1263 2004-10-30 Stefano Bettelli <[email protected]>
1264
1265 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (screen_records): new
1266 feature. The syntax hash can have a fifth field, acting as a filter.
1267 Unless it matches the optional $fregex argument, the record is
1268 rejected. This allows us to exclude some tags from general usage.
1269 If $fregex is undefined, all tags with a filter are rejected. This
1270 mechanism is currently used only for the Exif thumbnail.
1271 (screen_records): match against /^$rule$/s and not /^$rule$/, i.e.,
1272 use the 's' modifier, forcing the binded scalar to be interpreted
1273 as a single string (thumbnail data is rejected otherwise ...)
1274 (remove_app1_Exif_info): if $index is undefined, it defaults to -1.
1275 So, both (-1) and undef cause all Exif APP1 segments to be removed.
1276
1277 * lib/Image/MetaData/JPEG.pm (save): it is remarkable that this method
1278 can write not only to a disk file, but also to a variable in memory.
1279 A disk file is written if $filename is a scalar with a valid file
1280 name; memory is instead used if $filename is a scalar reference.
1281 Documentation updated. Tests added to t/JPEG_2_JPEG_class.t
1282
1283 2004-10-29 Stefano Bettelli <[email protected]>
1284
1285 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (ordered_record_list):
1286 this helper function returns an ordered list of records. Records are
1287 sorted according to the numerical value of their key; if the key is
1288 not numeric, but its translation matches Idx-n, n is used. If even
1289 this fails, a stringwise comparison is performed ($REFERENCE records).
1290 Used only by set_Exif_data().
1291
1292 * lib/Image/MetaData/JPEG.pod: added an example on how to adjust
1293 the DateTime record in Exif APP1 IFD0, since this seems very popular
1294
1295 * lib/Image/MetaData/JPEG/Record.pm (string_manipulator): this new
1296 routine is used by Record::get_description to format $ASCII and
1297 $UNDEF values. Unreasonably long strings are trimmed and non-printing
1298 characters are replaced with their hexadecimal representation. Strings
1299 are then enclosed between delimiters, and null-terminated $ASCII
1300 strings have their last character chopped off (but a dot is added
1301 after the closing delimiter). $ASCII strings use a " as delimiter,
1302 while $UNDEF strings use '. Test scripts and files corrected.
1303
1304 * lib/Image/MetaData/JPEG/Tables.pm ($HASH_APP1_ROOT_GENERAL): this
1305 new hash table describes the root directory of an Exif APP1 segment.
1306
1307 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (screen_records): during
1308 the textual-to-numeric translation stage, apply the translation only
1309 if the tag, translated with JPEG_lookup, is numeric (before, it was
1310 applied when the untranslated tag was not numeric). This allows us
1311 to introduce "translations" for records with textual tags only: the
1312 translated tag will be of the form "Idx-$n", and $n will be used to
1313 force an ordering. For instance, ('Identifier', 'Endianness',
1314 'Signature', 'ThumbnailData'), in the root directory of an Exif APP1
1315 segment, are translated to ('Idx-1', 'Idx-2', 'Idx-3', 'Idx-4').
1316
1317 2004-10-28 Stefano Bettelli <[email protected]>
1318
1319 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_TIFF_header):
1320 the 'Endianness' record is not an Exif record, so its type is not
1321 defined; it was turned to the $UNDEF type, to allow for a syntactical
1322 rule to be used on it. In general, the difference between $ASCII and
1323 $UNDEF is meaningful only in true Exif records (the former have a
1324 terminating null character, the latter correspond to a completely
1325 free format): one should conform to this prescription at least in
1326 APP1 and APP3.
1327
1328 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_app1): this method
1329 now looks for specific named records with search_record_value, instead
1330 of relying stupidly on the first record.
1331
1332 2004-10-27 Stefano Bettelli <[email protected]>
1333
1334 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (set_Exif_data): added
1335 a special case for ROOT_DATA: you can only modify the endianness (and
1336 only to $BIG_ENDIAN or $LITTLE_ENDIAN), everything else is rejected.
1337 A few tests added to t/JPEG_5_exif_IMAGE.t.
1338
1339 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_ifd): correction
1340 for the usual (and here benignous) reference-to-empty-string bug.
1341
1342 * lib/Image/MetaData/JPEG/Segment.pm (follow_path): no more; the
1343 functionality of this method is now almost completely in search_record,
1344 so the code for follow_path could be included in the only two methods
1345 requiring it: Segment::dump_ifd and JPEG::get_Exif_data.
1346
1347 * t/JPEG_1_segments.t: a few tests added for Segment::search_record
1348
1349 * lib/Image/MetaData/JPEG/Segment.pm (search_record): completely new
1350 design for this method: it searches for a record with a given key in
1351 a given record directory, returning a reference to the record if the
1352 search was fruitful, undef otherwise. Search specified as follows:
1353 1) a start directory is chosen by looking at the first argument:
1354 if it is an ARRAY ref it is popped out and used, otherwise the
1355 top-level directory (i.e., $this->{records}) is selected;
1356 2) a $keystring is created by joining all remaining arguments on
1357 '@', it is exploded into a @keylist on the same character;
1358 3) these keys are used for an iterative search starting from the
1359 initially chosen directory: all but the last key must correspond
1360 to $REFERENCE records. If $key is exactly "FIRST_RECORD" /
1361 "LAST_RECORD", the first/last record in the current dir is used.
1362 The behaviour is now similar to that of the JPEG_lookup function, and
1363 should spare some lines of code. Trivial modifications in the following
1364 methods: (Segment methods) follow_path, provide_subdirectory,
1365 parse_app1_exif, parse_ifd, parse_resource_data_block, dump_com,
1366 dump_ifd, dump_app13, (JPEG methods) get_comments, get_dimensions,
1367 get_app0_data, is_app1_Exif, get_Exif_data, build_IFD_directory_tree,
1368 is_app13_ok, retrieve_app13_subdir, set_app13_data, (test scripts)
1369 JPEG_1_segments.t, JPEG_4_app13.t, JPEG_5_exif.t.
1370 (search_record_value): a simple wrapper around search_record(): it
1371 returns the record value if the search is succesful, undef otherwise.
1372
1373 * saved as private version 0.11e
1374
1375 * t/JPEG_5_exif_IMAGE.t: this small test script checks the IMAGE_DATA
1376 alias for IFD0_DATA and SUBIFD_DATA (supported in JPEG_app1_exif.pl).
1377
1378 2004-10-26 Stefano Bettelli <[email protected]>
1379
1380 * lib/Image/MetaData/JPEG/Tables.pm: $NATIVE_ENDIANNESS is calcula-
1381 ted every time and represents the native endianness of the current
1382 machine. It is exported in the :Endianness group.
1383
1384 * lib/Image/MetaData/JPEG/Record.pm (check_consistency): updated
1385 not to fail with floating point numbers (decimal numbers cannot
1386 always be converted to floating point numbers, so the comparison
1387 must be limited to, say, six decimal digits). It is now possible
1388 to set the FovCot tag .....
1389
1390 2004-10-23 Stefano Bettelli <[email protected]>
1391
1392 * lib/Image/MetaData/JPEG/Segment.pm (set_data): replace \do{''}
1393 with \(my $ns = "") [thanks to A. Komarnitsky for helping in finding
1394 the inconsistency in my previous stupid approach].
1395 (new): ditto
1396
1397 2004-10-22 Stefano Bettelli <[email protected]>
1398
1399 * lib/Image/MetaData/JPEG/Record.pm
1400 (decode_integers): was decode()
1401 (encode_integers): was encode(), see later for this refactoring.
1402 (decode_floating): this method decodes a data area containing a
1403 sequence of floating point numbers, correctly taking into account
1404 the endianness. The type size $n can therefore be only 4, 8 or 12.
1405 But we cannot support extended double precision on 32-bit machines
1406 in general! (it is not required for JPEG decoding though)
1407 (encode_floating): obviously, the reverse of decode_floating. I
1408 suspect it is buggy and non-portable and a testing headaches.
1409 (new): the ctor has now the ability to read floating point values.
1410 (get): the get method has now the ability to encode floating points.
1411 (get_description): use %g as format string for floating point numbers
1412 A lot of tests added to check for this floating implementation.
1413
1414 2004-10-21 Stefano Bettelli <[email protected]>
1415
1416 * lib/Image/MetaData/JPEG/JPEG_various.pl (get_app0_data): this
1417 method now returns a reference to a hash with a plain translation
1418 of the content of the first interesting APP0 segment (this is the
1419 first 'JFXX' APP0 segment, if present, the first 'JFIF' APP0
1420 segment otherwise). Segments with errors are excluded. An empty
1421 hash means that no valid APP0 segment is present.
1422
1423 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (get_Exif_data): ditto
1424 (multi_level_merge): removed
1425
1426 * lib/Image/MetaData/JPEG/JPEG_app13.pl (get_app13_data): this method
1427 now returns data from the first appropriate APP13 segment only (undef
1428 if no such segment exists). The previous behaviour was inconsistent
1429 with JPEG::set_*_data, and it brought in more hassle than good. If one
1430 really has a strange file with more than one APP13 segment, he must
1431 deal with this strange case by accessing the segments individually.
1432 Tests and documentation updated.
1433
1434 2004-10-20 Stefano Bettelli <[email protected]>
1435
1436 * lib/Image/MetaData/JPEG/Tables.pm ($HASH_APP01_IFD0_MANDATORY):
1437 there are now two distinct hashes: %$HASH_APP1_IFD0_MANDATORY and
1438 %$HASH_APP1_IFD0_MANDATORY, possibly differing.
1439
1440 * t/JPEG_5_exif_IFD1.t: now t/JPEG_5_exif_IFD.t
1441
1442 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (screen_records): this
1443 is now a method, and its arguments are ($this, $data, $path); this
1444 new approach allows for more flexibility while checking for syntactical
1445 rules (indeed, also for more errors). Moreover, the method now simply
1446 returns the list ($data_rejected, $data_accepted) [in this order], so
1447 you still get $data_accepted only in scalar context (but note that the
1448 order in list context was the opposite before). Changed set_Exif_data
1449 to take this modification into account.
1450
1451 2004-10-16 Stefano Bettelli <[email protected]>
1452
1453 * saved as private version 0.11d
1454
1455 * lib/Image/MetaData/JPEG/Record.pm (check_consistency): this class
1456 static method receives a number of Record features (key, type and
1457 count) and a list of values, and tries to build a Record with that
1458 type and count containing those values. On success, it returns the
1459 record reference, on failure it returns undef. This subroutine is
1460 currently used by screen_records in JPEG_app1_exif.pl
1461
1462 2004-10-15 Stefano Bettelli <[email protected]>
1463
1464 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (screen_records):
1465 new feature: if a record value is a code reference instead of an
1466 array reference, the corresponding code is executed (passing the
1467 optional third argument $optional) and the result is stored. This
1468 is necessary for mandatory records which need to know the current
1469 segment. This feature is forbidden to the user (currently).
1470
1471 * lib/Image/MetaData/JPEG/Tables.pm (generate_lookup): this function
1472 now returns a hash reference. Also, non-exported hashes in Tables.pm
1473 are now addressed through their references. Also, %HASH_IPTC_GENERAL is
1474 no more exported (access it with JPEG_lookup{'APP13@__syntax_IPTC'}).
1475
1476 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (screen_records): moved
1477 %special_screen_rules's content into Tables.pm, where it belongs to.
1478 Now, a "super-regular-expression" is no more a special string, but
1479 a reference to an anonymous routine, stored in Tables.pm, and the
1480 screen_records method just recognises and executes it.
1481 The %special_screen_rules hash was a dispatch table for special
1482 syntax check routines (for those values which are not easy to test
1483 with a regular expression). These routines had to die if the test
1484 fails in any way.
1485
1486 2004-10-14 Stefano Bettelli <[email protected]>
1487
1488 * t/JPEG_5_exif_SubIFD.t: script for set_Exif_data with SUBIFD_DATA
1489
1490 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (set_Exif_data): adapted
1491 and tested for SubIFD, including Tables.pm; the %IFD_SUBDIRS hash has
1492 now some new deep entries, with key equal to '__mandatory', supplying
1493 mandatory records for a give $what (see set_Exif_data).
1494
1495 * lib/Image/MetaData/JPEG/Segment.pm (new): the Segment constructor
1496 now has a new mandatory argument (the first one): a reference to the
1497 parent entity (a JPEG structure object in general, but it can also
1498 be undef for "orphan" segments). This reference is currently used to
1499 get the picture dimensions for the mandatory 'Pixel*Dimension' in the
1500 Exif SubIFD, but it is going to be needed for other tags in the future.
1501 Additional files which required modifications: JPEG.pm, JPEG_app13.pl,
1502 JPEG_app1_exif.pl, JPEG_comments.pl and some test files. Tests added
1503 to the Segment ctor: it dies if some arguments are invalid.
1504
1505 2004-10-12 Stefano Bettelli <[email protected]>
1506
1507 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl
1508 (retrieve_Exif_subdirectories): suppressed
1509
1510 * lib/Image/MetaData/JPEG/Segment.pm (follow_path): this new
1511 helper method follows a '@' separated list of dir names and
1512 returns the final record list (or undef).
1513
1514 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (get_Exif_data):
1515 modified to accept the following values for $what:
1516 - ROOT_DATA APP1 (TIFF header records and similar)
1517 - IFD0_DATA APP1@IFD0 (primary image TIFF tags)
1518 - SUBIFD_DATA APP1@IFD0@SubIFD (Exif private tags in IFD0)
1519 - GPS_DATA APP1@IFD0@GPS (GPS data in IFD0)
1520 - INTEROP_DATA APP1@IFD0@SubIFD@Interop(erability in IFD0)
1521 - IFD1_DATA APP1@IFD1 (thumbnail TIFF tags)
1522 - IMAGE_DATA a merge of IFD0_DATA and SUBIFD_DATA
1523 - THUMB_DATA an alias for IFD1_DATA
1524 - THUMBNAIL the actual (un-)compressed thumbnail
1525 - ALL a structured merge of everything but THUMBNAIL
1526 A few tests were added to t/JPEG_5_exif.t. Documentation updated.
1527
1528 2004-10-09 Stefano Bettelli <[email protected]>
1529
1530 * lib/Image/MetaData/JPEG/Tables.pm (%HASH_APP3_SPECIAL/BORDERS) :
1531 tag names changed to something more "significant" ....
1532 (%HASH_APP1_IFD01_MAIN, %HASH_APP1_IFD01_ADDITIONAL)
1533 (%HASH_APP1_IFD01_COMPANIES, %HASH_APP1_SUBIFD_GENERAL),
1534 general reorganisation of these tables, containing tags for IFD0,
1535 IFD1 and SubIFD, with types, counts, regular expressions and
1536 support levels for various encodings and sections. Also, added
1537 some undocumented tags coming from Photoshop >= 7.0 treatment of
1538 raw camera files (any real reference welcome ...)
1539
1540 2004-10-08 Stefano Bettelli <[email protected]>
1541
1542 * lib/Image/MetaData/JPEG/Record.pm (is_signed): this method now
1543 returns true or false, instead of 'Y' or 'N' (more intuitive).
1544 (get_description): bug correction. Integer and rational numbers
1545 were always printed as signed integers. Now the correct conversion,
1546 '%u' for unsigned integers and '%d' for signed integers, is applied.
1547 Test added (this is subtle, because only appears to human beings).
1548
1549 2004-09-30 Stefano Bettelli <[email protected]>
1550
1551 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (get_Exif_data): when
1552 mapping the record list reference, one should make COPIES of the
1553 array references found in $_->{values}, otherwise the caller could
1554 use them to corrupt the internal structures. This was a terrible
1555 bug discovered indirectly by the coverage test. Its solution consists
1556 simply in replacing $_->{values} with [@{$_->{values}}]. Two tests
1557 added to t/JPEG_5_exif.t. Two tests also added to t/JPEG_4_app13.t
1558 for get_app13_data, but it was not affected by the problem.
1559 (multi_level_merge): this helper function implements the container
1560 merge necessary to JPEG::get_Exif_dat, and is more robust. Two
1561 tests added to t/JPEG_2_rare.t to actually test a merge of more
1562 than two segments.
1563
1564 2004-09-29 Stefano Bettelli <[email protected]>
1565
1566 * lib/Image/MetaData/JPEG/JPEG_comments.pl (join_comments): the
1567 two warnings have been transformed into exceptions.
1568
1569 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_app1): new checks
1570
1571 * lib/Image/MetaData/JPEG.pm (open_input): when testing $file_input
1572 for being a reference, explicitly ask that it is a scalar reference.
1573 (new): bug corrected, the call to close_input was lacking the
1574 current object pointer (i.e., $this-> before it). This confirms
1575 that Perl is not for serious programming.
1576
1577 * lib/Image/MetaData/JPEG/Segment.pm (update): trying to update a
1578 segment with errors calls 'die' now, not 'warn'. The same happens
1579 when trying to update a segment with no update support. Now, there
1580 is also a check on the number of records: trying to update a segment
1581 with no records throws an exception (this should catch segments
1582 created with the 'NOPARSE' flag, which clearly do not own records).
1583 (new): if the data reference among the arguments of the constructor
1584 is undefined, we definitely must save a reference to a modifiable
1585 empty string (like in \do{''}) and not to an unmodifiable one (like
1586 in \""). This was forbidding the update of initially "empty" segments.
1587 (set_data): the most robust approach for clearing the current buffer
1588 is to reset the buffer reference with a reference to a modifiable
1589 empty string (\ '' is unmodifiable)
1590 (output_segment_data): if the segment is too long and cannot be
1591 output, raise an exception (a warning is not effective).
1592
1593 * beginning test coverage and bug hunting session.
1594
1595 * t/JPEG_2_JPEG_class.t: the old t/JPEG_1_constructors.t and
1596 t/JPEG_2_methods.t are now merged in this file, which tries to
1597 test the Image::MetaData::JPEG class. A new t/JPEG_1_segments.t
1598 test script tries to test the Image::MetaData::JPEG::Segment class.
1599
1600 2004-09-28 Stefano Bettelli <[email protected]>
1601
1602 * lib/Image/MetaData/JPEG.pm (insert_segment): this method inserts
1603 a new segment into the current list of segments at position $pos.
1604 If the segment reference is undefined, the method fails silently.
1605 If $pos is undefined, the position is chosen automatically (using
1606 find_new_app_segment_position); if $pos is out of bound, an
1607 exception is thrown; this happens also if $pos points to the first
1608 segment and it is SOI. $segref may be a reference to a single
1609 segment or a reference to a list of segment references; everything
1610 else throws an exception. If overwrite is defined, it must be the
1611 number of segments to overwrite during the splice. This method is
1612 now used in JPEG_comments.pl, JPEG_app13.pl and JPEG_app1_exif.pl.
1613 Tests added to t/JPEG_2_methods.t. Documentation updated.
1614
1615 * constructs like $seg = $this->{segments}; @$seg = ... replaced
1616 with @{$this->{segments}} when not too cumbersome. Same for %$
1617
1618 * lib/Image/MetaData/JPEG.pm (drop_segments): [thanks to Christopher
1619 C. Weis for suggesting this feature] this method erases from the
1620 internal segment list all segments matching the passed $regex
1621 regular expression. If $regex is undefined or evaluates to the
1622 empty string, this method throws an exception, because I don't want
1623 the user to erase the whole file just because he/she did not
1624 understand what he was doing. The apocalyptic behaviour can be
1625 forced by setting $regex = ".". As a special case, if $regex ==
1626 "METADATA", all APP* and COM segments are erased. Documentation
1627 updated. Tests added to t/JPEG_2_methods.t.
1628 (drop_segments) is now used inside remove_all_comments,
1629 remove_app1_Exif_info and remove_app13_info.
1630
1631 2004-09-26 Stefano Bettelli <[email protected]>
1632
1633 * saved as private version 0.11c
1634
1635 * lib/Image/MetaData/JPEG/JPEG_various.pl (get_dimensions): bug
1636 corrected. This routine was not checking that the required records
1637 were present (they are not there when the segment is not parsed).
1638
1639 * lib/Image/MetaData/JPEG/Segment.pm (parse): bug corrected.
1640 If there is no error during this routine, $this->{error} must be
1641 left undefined; setting it to $@ does not work because it can be ''.
1642 (parse): the selection of the specific parse routine is now a
1643 Perl "switch", with a fallback case dispatching to parse_unknown().
1644
1645 * t/JPEG_2_rare.t: this new test script is meant to catch errors
1646 in seldom used methods (which is not easy to fit in other test
1647 scripts), like reparse_as(), get_app0_data(), parse_unknown();
1648 it was suggested by a coverag test with Devel::Cover. Also added
1649 a t/test_frankenstein.jpg with examples of some application
1650 segments not found in the standard t/test_photo.jpg
1651
1652 2004-09-25 Stefano Bettelli <[email protected]>
1653
1654 * lib/Image/MetaData/JPEG/Segment_parsers.pl
1655 (parse_resource_data_block): bug corrected. The trivial value for a
1656 data block name in Photoshop APP13 is the empty string ("", length 0),
1657 not the null character ("\000", length 1). This avoids a lot of
1658 stupid <> in the output of Record::get_description.
1659
1660 2004-09-24 Stefano Bettelli <[email protected]>
1661
1662 * lib/Image/MetaData/JPEG/JPEG_app13.pl: almost all methods updated
1663 for $APP13_PHOTOSHOP_DIRNAME and its management. This is probably
1664 not the cleanest solution, but it can do the job for the time being.
1665
1666 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_app13): updated
1667 for $APP13_PHOTOSHOP_DIRNAME (also dump_resource_data_block).
1668
1669 * lib/Image/MetaData/JPEG/Segment_parsers.pl
1670 (parse_resource_data_block): updated for $APP13_PHOTOSHOP_DIRNAME
1671
1672 * lib/Image/MetaData/JPEG/Tables.pm: new $APP13_PHOTOSHOP_DIRNAME
1673 variable with value 'Photoshop_RECORDS'; this is for supporting
1674 Photoshop records in a separate directory, in order to make their
1675 management similar to that of IPTC data. %JPEG_RECORD_NAME modified.
1676
1677 * t/JPEG_4_app13.t: updated set of tests for Photoshop/IPTC routines.
1678 Test files are: JPEG_4_app13_IPTC.t, JPEG_4_app13_set.t, JPEG_4_app13.t
1679
1680 * lib/Image/MetaData/JPEG/Tables.pm (generate_array): new variable
1681 $APP13_IPTC_DIRNAME = 'IPTC_RECORDS' in Tables.pm in group TagsAPP13.
1682
1683 2004-09-22 Stefano Bettelli <[email protected]>
1684
1685 * lib/Image/MetaData/JPEG/JPEG_app13.pl: all methods in this file
1686 were changed to reflect the new approach for getting/setting Photoshop
1687 data; the list of new names is as follows:
1688 (retrieve_app13_IPTC_segment) --> retrieve_app13_segment(index, what)
1689 (is_app13_IPTC) --> is_app13_ok(what)
1690 (provide_app13_IPTC_segment) --> provide_app13_segment(what)
1691 (remove_app13_IPTC_info) --> remove_app13_info(index, what)
1692 (get_IPTC_data) ... 2x --> get_app13_data(type, what)
1693 (set_IPTC_data) ... 2x --> set_app13_data(data, action, what)
1694 many changes in helper rotines and algorithms, too long to explain
1695 here. Read about the new interface in JPEG.pod.
1696
1697 * lib/Image/MetaData/JPEG.pod: reorganisation of this man page and
1698 new sections on getting/setting Photoshop data. This changes the
1699 previous interface a bit, but, hey, I told you that it could happen!
1700
1701 * MANIFEST: added a test for the perldoc page based on Pod::Checker
1702 as t/JPEG_p_podchecker.t (test skipped if the module is not there)
1703
1704 2004-09-20 Stefano Bettelli <[email protected]>
1705
1706 * tested as version 0.11b
1707
1708 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl
1709 (forge_interoperability_IFD): this method takes care to create an
1710 Interoperability IFD with standard values (dimensions are calculated).
1711 This should avoid creating gratuitous inconsistencies.
1712
1713 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (set_Exif_data): added
1714 support for INTEROP_DATA. Tests for this software are collected in
1715 JPEG_5_exif_INTEROP.t. Documentation updated in JPEG.pod
1716
1717 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (set_GPS_DATA): this
1718 method was merged with set_Exif_data after making it more general.
1719 The generalisation to other data types should now be simpler ....
1720
1721 * t/JPEG_4b_IPTC.t: renamed to JPEG_4_IPTC_syntax.t
1722 * t/JPEG_5b_exif.t: renamed to JPEG_5_exif_GPS.t
1723
1724 2004-09-19 Stefano Bettelli <[email protected]>
1725
1726 * lib/Image/MetaData/JPEG/Tables.pm (JPEG_lookup): corrected a bug
1727 which was preventing keys evaluating to false from being accepted.
1728 "unless $key" is not the same as "unless defined $key".
1729
1730 2004-09-18 Stefano Bettelli <[email protected]>
1731
1732 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (screen_records):
1733 This helper function takes a hash reference $data and an IFD path
1734 specification $path, like 'APP1@IFD0@GPS'. It tries to convert the
1735 elements of $data into valid records according to the specific
1736 syntactical rules of the corresponding IFD. It returns a list of
1737 two hash references: the first list contains the key-recordref
1738 pairs for successful conversions, the second list the key-value(ref)
1739 pairs for unsuccessful ones. ... this function extracts and
1740 generalises the syntax tests which were once in set_GPS_DATA.
1741 (%special_screen_rules): this hash is a dispatch table for special
1742 syntax check routines (for those values which are not easily tested
1743 with a regular expression). I suspect this will grow a lot ...
1744 (complement_records): another helper routine for inserting records
1745 into hashes when they are not already present. These routines
1746 should be used only inside the screen_records function.
1747
1748 * lib/Image/MetaData/JPEG/Tables.pm (%IFD_SUBDIRS): A sub-hash can
1749 also have a '__syntax' key, returning a hash of syntactical
1750 properties to be respected by data in the corresponding IFD. This
1751 special entry is of course treated differently from the others
1752 ... It was introduced in order to collect in the same place all
1753 information necessary for setting new data in IFD-like segments. As
1754 a first result, it avoids the need to export %HASH_GPS_GENERAL. A
1755 syntactical specification for key $key is now accessed in the
1756 following way: @{$IFD_SUBDIRS{'APP1@IFD0@GPS'}{__syntax}{$key}};
1757
1758 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (build_IFD_directory_tree):
1759 This method, obviously, creates a (sub)directory tree in an IFD-like
1760 segment (i.e. APP1/APP3), and takes care of the "extra" field of the
1761 newly created directories if mandatory or useful. I really think that
1762 this "extra" field should be managed differently ....
1763
1764 2004-09-17 Stefano Bettelli <[email protected]>
1765
1766 * Set all my e-mail addresses in the package to <[email protected]>
1767
1768 * lib/Image/MetaData/JPEG/Tables.pm (%IFD_SUBDIRS): reorganisation
1769 of this hash, which was not flexible enough; it is now a two-level
1770 hash, supporting some changes in JPEG_app1_exif.pl. All relevant
1771 files have been updated (Segment_dumpers.pl, Segment_parsers.pl).
1772
1773 2004-09-15 Stefano Bettelli <[email protected]>
1774
1775 * lib/Image/MetaData/JPEG/Tables.pm: corrected a bug slipped in
1776 at some point during the rewrite of Tables.pm; the following line
1777 our $THTIFF_LENGTH = JPEG_lookup('APP1@IFD1@StripOffsets'); had to be
1778 our $THTIFF_LENGTH = JPEG_lookup('APP1@IFD1@StripByteCounts');.
1779 Since the error was not showing up however, this stuff is probably
1780 redundant, or I am missing something ...
1781
1782 * lib/Image/MetaData/JPEG/Tables.pm (JPEG_lookup): this method now
1783 joins all arguments (references are rejected) on '@', then splits
1784 the result string on '@' again, in order to be more consistent and
1785 simpler (?). Calls of JPEG_lookup changed accordingly in Record.pm,
1786 Segment_parsers.pl, Segment_dumpers.pl, JPEG_app13.pl and
1787 JPEG_app1_exif.pl.
1788
1789 2004-09-04 Stefano Bettelli <[email protected]>
1790
1791 * lib/Image/MetaData/JPEG.pod: removed the REFERENCES section in
1792 appendix, and the "references" file from the package. All relevant
1793 references will be written directly to the perldoc page. Also,
1794 reworked the Interoperability IFD section a bit.
1795
1796 2004-09-03 Stefano Bettelli <[email protected]>
1797
1798 * tested as version 0.11a
1799
1800 * lib/Image/MetaData/JPEG/JPEG_app13.pl (set_IPTC_data): forced an
1801 ordering on keys during the initial scan; this is necessary because
1802 the same key can be present twice, in numeric and textual form, and
1803 we want the corresponding value merging to be stable (numeric keys
1804 goes first). Same thanks as for the previous bug.
1805
1806 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_ifd): use
1807 for (sort keys %IFD_SUBDIRS) ... instead of for (keys %IFD_SUBDIRS),
1808 so as to fix an undefined ordering in the APP1 IFD0 subdirectories.
1809 This was causing a lot of problems during "make test". Thanks to
1810 Andrea Maestrutti, Dan Eble, and the perl.cpan.testers for helping
1811 correcting this bug.
1812
1813 * t/JPEG_5_exif.t: changed some stupid "is_deeply" to "is".
1814
1815 2004-08-08 Stefano Bettelli <[email protected]>
1816
1817 * saved current version as Image-MetaData-JPEG-0.11, posted to CPAN
1818
1819 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (set_Exif_data_GPS_DATA):
1820 thanks to the previous changes, when creating a new (empty) GPS
1821 subdirectory, it is not necessary to insert a 'GPSInfo' offset record,
1822 only the 'GPS' REFERENCE record; if fact, its value would in any case
1823 be wrong, and it will be calculated automatically at update time.
1824 We need however to set the "extra" field of this REFERENCE record,
1825 in order to mimick the case when it is parsed directly from a file.
1826
1827 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_TIFF_header):
1828 since we decided not to register offset records, the 'IFD0_Pointer'
1829 record was dropped (i.e., its value is read and used, but it is
1830 not stored in the main record list). This change is even more
1831 natural since its value is almost always 8. Trivial doc. changes.
1832
1833 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_ifd): modified
1834 this method to take changes in parse_ifd into account. There is a
1835 special treatement for tags holding an IFD offset; these tags are
1836 regenerated on the fly (since they are no more stored) and their
1837 value is recalculated and written to the raw data area. This should
1838 change absolutely nothing in the final file layout.
1839 (dump_app1_exif): the final call to reparse_as() is no more necessary;
1840 this was the old warning note: currently, the dump process in Exif
1841 APP1 recalculates some offsets (IFD links), but does not overwrite
1842 the parsed records, so that the raw data area and the parsed structure
1843 are not in sync. Reparsing the segment is a quick fix, but I really
1844 should update the IFD links' records, or, even better, avoid to write
1845 these offsets among the records, because they are not interesting
1846 to the end user.
1847
1848 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_ifd): this
1849 method, after setting up the concerned IFD, searches for deeper
1850 IFDs with the help of %IFD_SUBDIRS and, if found, parses them
1851 recursively; for every new subdir, a REFERENCE record is created,
1852 pointing to it. This method was changed in the following way:
1853 the originating offset record is removed because it contains very
1854 fragile information (it should be recalculated every time something
1855 changes in Exif APP1, for instance, carrying close to zero info);
1856 moreover, its textual tag is saved in the "extra" field of the
1857 generated REFERENCE record (just for reference).
1858
1859 2004-08-07 Stefano Bettelli <[email protected]>
1860
1861 * Saved as PRIVATE version 0.10f
1862
1863 * lib/Image/MetaData/JPEG/Tables.pm: deeply modified the layout.
1864 Some variables make now use of JPEG_lookup, instead of declaring
1865 redundantly other variables. This may be a bit slow, but is cleaner.
1866 Also, I have declared all private variables with 'my' and all
1867 exportable ones with 'ours'. Then I have prepared subclasses of
1868 exportable variables with %EXPORT_TAGS, so that they can be
1869 imported selectively by the various modules and files. No variable
1870 is now exported by default.
1871
1872 * lib/Image/MetaData/JPEG.pod: trivial change in the section about
1873 Record objects to document the new JPEG_lookup function. But this
1874 documentation needs to be revised to report about import rules.
1875
1876 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (get_Exif_data): updated
1877 to use JPEG_lookup instead of searching directly %JPEG_RECORD_NAME;
1878 (set_Exif_data_GPS_DATA): same thing
1879
1880 * lib/Image/MetaData/JPEG/JPEG_app13.pl: updated the %IPTC_tags
1881 and %IPTC_names hashes in order to use JPEG_lookup.
1882
1883 * lib/Image/MetaData/JPEG/Record.pm (get_description): modified
1884 to use JPEG_lookup instead of searching directly %JPEG_RECORD_NAME.
1885
1886 * lib/Image/MetaData/JPEG/Record.pm: moved @JPEG_RECORD_TYPE_LENGTH,
1887 @JPEG_RECORD_TYPE_CATEGORY and @JPEG_RECORD_TYPE_SIGN to Table class.
1888
1889 * lib/Image/MetaData/JPEG/Tables.pm (JPEG_lookup): this helper
1890 function returns record data from the %JPEG_RECORD_NAME hash. The
1891 argument list is a list of keys for exploring the variuous hash
1892 levels; e.g., if the list is ('APP1', 'IFD0', 'GPS', 0x1e), the
1893 selected value is $JPEG_RECORD_NAME{APP1}{IFD0}{GPS}{0x1e}.
1894 If, at some point during the search, an argument fails (it is not
1895 a valid key) or it is not defined, the search is interrupted, and
1896 undef is returned. Note also that the return value can be a string
1897 or a hash reference, depending on the hash search depth. If the key
1898 lookup for the last argument fails, a reverse lookup is run (i.e.,
1899 the key corresponding to the value equal to the last user argument
1900 is searched). If even this lookup fails, undef is returned.
1901
1902 2004-08-06 Stefano Bettelli <[email protected]>
1903
1904 * Saved as PRIVATE version 0.10e
1905
1906 * lib/Image/MetaData/JPEG.pod: added a section about changing Exif
1907 data (which currently is limited to GPS data), and a very extensive
1908 appendix about valid records for Exif APP1, which will be used as
1909 a line guide for the future Exfi setters.
1910
1911 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (set_Exif_data_GPS_DATA):
1912 this method implements the setter of Exif GPS data; it includes a
1913 lot of format checks and it is moderately simple, since GPS tags
1914 are not too complicated. A lot of tests added to check GPS data
1915 syntax. Documentation updated (so, read there ...)
1916
1917 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (set_Exif_data): entry
1918 point for setters of Exif APP1 data. It works a hash reference $data,
1919 $what in /GPS_DATA|...todo/ and $action in /ADD|UPDATE|SET/, but this
1920 interface might not be "official".
1921
1922 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_app1_exif): added
1923 a reparse_as at the end of this method; currently, the dump process
1924 in Exif APP1 recalculates some offsets (IFD links), but does not
1925 overwrite the parsed records, so that the raw data area and the
1926 parsed structure are not in sync. Reparsing the segment is a quick
1927 fix, but I really should update the IFD links' records, or, even
1928 better, avoid to write these offsets among the records, because they
1929 are not interesting to the end user.
1930
1931 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (get_Exif_data): check
1932 added; this method returns immediately (with undef) if the current
1933 Segment is not an Exif APP1 Segment.
1934
1935 * lib/Image/MetaData/JPEG/Record.pm (get_description): C-strings,
1936 i.e., null-terminated strings, have now the last null character
1937 chopped off, but a '.' is written after the closing '"'. This
1938 should make the output more readable.
1939
1940 2004-08-05 Stefano Bettelli <bettelli@localhost>
1941
1942 * Saved as PRIVATE version 0.10d
1943
1944 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (get_Exif_data): updated
1945 the Structure-level method to deal with the different data types
1946 returned by the Segment-level method. Tests added.
1947
1948 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl (get_Exif_data): added
1949 a second argument ($what) controlling the subset of Exif records
1950 returned by this method (this is far too long to explain here,
1951 read the documentation for this). Summarising:
1952 - ALL (all Exif and preamble records) ref to hash of hashes
1953 - IMAGE_DATA IFD0 + IFD0@SubIFD (primary image) ref to hash
1954 - THUMB_DATA IFD1 (thumbnail image) ref to hash
1955 - GPS_DATA IFD0@GPS (GPS data) ref to hash
1956 - INTEROP_DATA IFD0@SubIFD@Interop (interoperabilty) ref to hash
1957 - THUMBNAIL (the thumbnail data area in APP1) ref to scalar
1958 Tests added. Documentation updated. This approach should be much
1959 more user-friendly and looks like the definitive interface I want
1960 to use for inquiring Exif data.
1961
1962 2004-08-04 Stefano Bettelli <bettelli@localhost>
1963
1964 * Saved as PRIVATE version 0.10c
1965
1966 * lib/Image/MetaData/JPEG/JPEG_app13.pl (set_IPTC_data): corrected
1967 a silent bug: when testing for the presence of the RecordVersion
1968 tag, don't just check that there is an entry in the hash, but also
1969 check that the array pointed to by this hash is not empty.
1970
1971 * lib/Image/MetaData/JPEG/JPEG_app13.pl (set_IPTC_data): a new
1972 functionality added to the "setter". The $action argument can be:
1973 - ADD : new records are added and nothing is deleted; however, if
1974 you try to add a non-repeatable record which is already present,
1975 the newly supplied value replaces the pre-existing value.
1976 - UPDATE : new records replace those with the same tags, but the others
1977 are preserved. This makes it possible to modify repeatable records.
1978 - REPLACE : all records present in the IPTC subdirectory are deleted
1979 before inserting the new ones.
1980 So, 'ADD' and 'REPLACE' are as before, while 'UPDATE' is new and
1981 allows for selective replacement of some tags. The default remains
1982 'REPLACE'. Documentation updated. Tests added and updated.
1983
1984 2004-08-03 Stefano Bettelli <bettelli@localhost>
1985
1986 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_app2_ICC_tags):
1987 updated to reflect the changes in Record::get_size.
1988
1989 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_interop):
1990 updated to reflect the changes in Record::get_size.
1991
1992 * lib/Image/MetaData/JPEG/Segment.pm (create_record): $count means
1993 now "length" if the record type is variable-length and the data area
1994 is specified through an offset (but I think this never happens).
1995
1996 * lib/Image/MetaData/JPEG/Record.pm (new): according to the new
1997 meaning of "count" in the Record class, the argument $count in the
1998 constructor changes like this: if the type is fixed-length, $count
1999 is mandatory and must correspond to the number of values to be
2000 read from the passed scalar; if the type is variable-length, $count
2001 is optional (if specified, it is a counter-check; it must correspond
2002 to the size of the passed scalar).
2003
2004 * lib/Image/MetaData/JPEG/Record.pm: some useless incoherences
2005 eliminated (dangerous?): the type length in @JPEG_RECORD_TYPE_LENGTH
2006 for non-numeric types (currently ASCII strings, UNDEF strings and
2007 Perl references) is set to zero; it is meant with this that the type
2008 length is variable, and all sizes should be accepted. This implicitely
2009 changes Record::get_size to return 0 also for ASCII and UNDEF.
2010
2011 2004-08-01 Stefano Bettelli <bettelli@localhost>
2012
2013 * lib/Image/MetaData/JPEG/JPEG_app1_exif.pl: changed JPEG_exif.pl
2014 to JPEG_app1_exif.pl, for uniformity with JPEG_app13.pl
2015
2016 * lib/Image/MetaData/JPEG.pod: re-checked and clarified the part
2017 of the documentation concerning IPTC data management, including
2018 all previous changes and a note on what is translated when
2019 'TEXTUAL' is on (tags, i.e, keys, not the values).
2020
2021 * lib/Image/MetaData/JPEG/JPEG_app13.pl (set_IPTC_data): reworked
2022 this method. Added a new logic for $action == 'ADD': old values
2023 are merged to new ones; if this leads to the violation of a non
2024 repeatability constraint, only the new value is retained (this is
2025 done by the new helper function shift_non_repeatables). Added
2026 a new logic to make sure that a 'RecordVersion' record is always
2027 present. Updated all IPTC tests relevant to 'set'.
2028
2029 * lib/Image/MetaData/JPEG/Tables.pm: corrected a bug in the 'word',
2030 'line' and 'paragraph' regular expression for IPTC data (they were
2031 accepting an arbitrary prefix or suffix). Corrected and updated
2032 the appropriate tests in t/JPEG_4b_IPTC.t.
2033
2034 * lib/Image/MetaData/JPEG/JPEG_app13.pl (get_IPTC_data): do not
2035 delete the 'RecordVersion' record from the returned hash. I do
2036 not know if this is the right choice, but the previous behaviour
2037 was not documented either. Added a test for this.
2038
2039 2004-07-19 Stefano Bettelli <bettelli@localhost>
2040
2041 * Saved as PRIVATE version 0.10b
2042
2043 * lib/Image/MetaData/JPEG.pm (get_segments): the passed regular
2044 expression is now changed to "." if undefined or set to the empty
2045 string (thus returning all segments or all indexes). I do this
2046 because I want to avoid the stupid behaviour of m//:
2047 from `man perlop`: if the pattern evaluates to the empty string,
2048 the last successfully matched regular expression is used instead;
2049 if no match has previously succeeded, this will (silently) act
2050 instead as a genuine empty pattern. Added two tests against this.
2051
2052 * lib/Image/MetaData/JPEG/JPEG_exif.pl (is_app1_Exif): bug corrected;
2053 this was crashing when presented an APP1 segment without a record
2054 called 'Identifier' (this happens for XML APP1 segments ....)
2055
2056 2004-07-18 Stefano Bettelli <bettelli@localhost>
2057
2058 * t/test_photo.jpg, t/test_photo.desc: reduced the test image size,
2059 this cuts down its weight from ~ 200KB to only 33KB.
2060
2061 * lib/Image/MetaData/JPEG.pm (save): added binmode for file open
2062 calls (it turned out that on Windows it really makes a difference,
2063 also when writing). Thanks to Andrea Maestrutti for help with this bug.
2064
2065 * lib/Image/MetaData/JPEG/Segment.pm (show_directory)
2066 (Directory_Banner): added protections against invalid
2067 references among function arguments. Mark invalid references.
2068
2069 * lib/Image/MetaData/JPEG/Segment.pm (get_description): chomp
2070 is run only if $this->{error} is defined (avoid error situations).
2071
2072 2004-07-16 Stefano Bettelli <bettelli@localhost>
2073
2074 * t/JPEG_1_constructors.t, t/JPEG_2_methods.t: added binmode for
2075 file open calls (it turned out that on Windows it really makes a
2076 difference!). Thanks to Andrea Maestrutti for help with this bug.
2077
2078 * t/JPEG_0_records.t: added (it had been left out from the module
2079 submitted to CPAN because it was not listed in MANIFEST).
2080
2081 2004-07-13 Stefano Bettelli <bettelli@localhost>
2082
2083 * saved current version as Image-MetaData-JPEG-0.10, posted to CPAN
2084
2085 * lib/Image/MetaData/JPEG.pod: documentation updated. IPTC info
2086 largely rewritten. Exif info introduced. New appendices.
2087
2088 * lib/Image/MetaData/JPEG/Segment.pm (output_segment_data): added
2089 a debugging check on the maximum size for a segment.
2090
2091 * lib/Image/MetaData/JPEG/JPEG_app13.pl (set_IPTC_data): substantial
2092 modification of this methods (many more checks). It now accepts IPTC
2093 data in various formats and updates the IPTC subdirectory in the
2094 segment. The key type of each entry in the input %$data hash can be
2095 numeric or textual, independently of the others (the same key can
2096 appear in both forms, the corresponding values will be appended).
2097 The value of each entry can be an array reference or a scalar (you
2098 can use this as a shortcut for value arrays with only one value).
2099 The $action argument can be 'ADD' or 'REPLACE', and it discriminates
2100 weather the passed data must be added to or must replace the current
2101 datasets in the IPTC subdir. The return value is a reference to a
2102 hash containing the rejected key-values entries. The entries of %$data
2103 are not modified. An entry in in the %$data hash can be rejected
2104 for various reasons:
2105 - the tag is textual or numeric and it is not known;
2106 - the tag is numeric and not in the range 0-255;
2107 - the entry value is an empty array;
2108 - the non-repeatable property is violated;
2109 - the tag is marked as invalid;
2110 - the length of a value is invalid;
2111 - a value does not match its mandatory regular expr.
2112 This is a major improvement on the formerly unattended user input.
2113 There is not a similar check on data already written in the file,
2114 because it is not clear what one should do in presence of "errors".
2115
2116 * lib/Image/MetaData/JPEG/JPEG_app13.pl (value_is_OK): this private
2117 function is able to test wether a given array of values fits with
2118 a given IPTC tag. Info is taken from %HASH_IPTC_GENERAL. It is
2119 called only by set_IPTC_data.
2120
2121 * lib/Image/MetaData/JPEG.pm (find_new_app_segment_position): added
2122 a check, just in order to avoid a warning for half-read files with
2123 an incomplete set of segments; no "position" is returned past the
2124 segment array end (i.e. not smaller than scalar get_segments()).
2125 Added a test against this case.
2126
2127 2004-07-12 Stefano Bettelli <bettelli@localhost>
2128
2129 * lib/Image/MetaData/JPEG/JPEG_app13.pl (get_IPTC_data): changed
2130 the behaviour of this method, which is now a generalisation of
2131 the method with the same name in the Segment class, not only an
2132 interface to. First, all IPTC APP13 segment are retrieved (if
2133 none is present, the undefined value is returned). Then,
2134 get_IPTC_data is called on each of these segments, passing the
2135 argument ($type) through. The results are then merged in a single
2136 hash and a reference to it is returned.
2137
2138 * lib/Image/MetaData/JPEG.pod: added a reference section as an
2139 appendix specifying the set of valid IPTC tags for APP13, as
2140 well as the additional constraints on their values. The same
2141 information is now available in %HASH_IPTC_GENERAL in Tables.pm
2142
2143 * lib/Image/MetaData/JPEG/JPEG_app13.pl (get_IPTC_data,set_IPTC_data):
2144 removed the "XML" option, since it was really only poorly implemented
2145 in the getter; it will be reinstated only when and if there is a
2146 real need for this. Modified the perldoc page accordingly.
2147
2148 2004-07-11 Stefano Bettelli <bettelli@localhost>
2149
2150 * lib/Image/MetaData/JPEG/JPEG_exif.pl (retrieve_app1_Exif_segment):
2151 (provide_app1_Exif_segment, remove_app1_Exif_info, get_Exif_data)
2152 (set_Exif_data, [Segment]is_app1_Exif, retrieve_Exif_subdirectories)
2153 (get_Exif_data) new methods very similar to APP13 IPTC high level
2154 functions. They implement, of course, the "read" part of Exif APP1
2155 segments. The get_Exif_data method returns a reference to a hash
2156 containing a named (the tag) hash references. Each sub-hash contains
2157 a copy of all Exif tags/values present in a particular IFD (sub)di-
2158 rectory (including a special root directory containing some tags
2159 and the links to IFD0 and IFD1). As usual, the output format can
2160 be "NUMERIC" or "TEXTUAL". An example of the returned reference is:
2161
2162 { APP1 => { Endianness => [ "II" ], ... },
2163 APP1@IFD0 => { Model => [ "KODAK DX3900" ], ... },
2164 APP1@IFD0@SubIFD => { FocalLength => [117, 10], ... },
2165 APP1@IFD0@SubIFD@Interop => { InteroperabilityIndex => ["R98"], ...},
2166 APP1@IFD1 => { XResolution => [72, 1], ... }
2167 }
2168
2169 * lib/Image/MetaData/JPEG/JPEG_app13.pl (set_IPTC_data): added an
2170 explicit protection against an undefined value for the first argument
2171
2172 2004-07-10 Stefano Bettelli <bettelli@localhost>
2173
2174 * lib/Image/MetaData/JPEG/JPEG_app13.pl (remove_app13_IPTC_info):
2175 this new method eliminates all traces of IPTC information from
2176 the $index-th APP13 IPTC segment. If, after this, the segment is
2177 empty, it is eliminated from the list of segments in the file.
2178 If $index is (-1), all APP13 IPTC segments are affected at once.
2179 Added some tests for this in JPEG_4_iptc.t
2180
2181 2004-07-10 Stefano Bettelli <bettelli@localhost>
2182
2183 * lib/Image/MetaData/JPEG/Segment_dumpers.pl (dump_app1),
2184 (dump_app1_exif, dump_TIFF_header, dump_ifd): implemented a set of
2185 routines for dumping an Exif APP1 segment to disk. The thumbnail
2186 size is checked for consistency. All records within an IFD are
2187 ordere according to their tags. There is no unused space in the
2188 dump, so just calling update() on an Exif APP1 segment even without
2189 modifying its content can give you a smaller file (some tens of
2190 kilobytes can be saved). Checked it works on all my pictures.
2191
2192 2004-07-09 Stefano Bettelli <bettelli@localhost>
2193
2194 * lib/Image/MetaData/JPEG/Record.pm (encode, decode): corrected
2195 various bugs for signed types and nibbles. Logic rewritten. The
2196 directive "use integer" was abandoned, since it limits integers
2197 to signed 32-bits (while we need at least unsigned 32-bits). The
2198 performance drop is probably negligible if the computer has a
2199 math coprocessor. Written a comprehensive test suite for the
2200 Record class (t/JPEG_0_records.t).
2201
2202 * lib/Image/MetaData/JPEG/Segment.pm (set_data): this method now
2203 accepts a reference or a scalar as first argument, and treats it
2204 accordingly (this avoids copying in some contexts).
2205
2206 2004-07-08 Stefano Bettelli <bettelli@localhost>
2207
2208 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_app1_exif,
2209 parse_app3): adapted to the new parse_ifd style. These routines
2210 look now much simpler (although they are a bit less flexible).
2211
2212 * lib/Image/MetaData/JPEG/Segment_parsers.pl (parse_ifd): this
2213 method takes now care to parse the subdirectories of a given IFD
2214 on its own (using the %IFD_SUBDIRS lookup table). The new argument
2215 list is ($this, $dirnames, $link, $tiff_base, $offset_ref, $no_next),
2216 i.e. $tiff_base is a value, not a ref, and @vip_tags is no more.
2217
2218 * lib/Image/MetaData/JPEG/Tables.pm (%IFD_SUBDIRS): this new enum
2219 is intended to automatise the parsing of subdirectories of IFDs
2220 in APP1 and APP3 (needed also for dumping I think).
2221
2222 * lib/Image/MetaData/JPEG/Segment.pm (set_data): let this method
2223 return the size of appended data.
2224
2225 * lib/Image/MetaData/JPEG/Record.pm (encode): corrected two bugs
2226 on this untested method (overwriting $_ in an internal loop and
2227 not getting the endianness right).
2228
2229 2004-07-07 Stefano Bettelli <bettelli@localhost>
2230
2231 * lib/Image/MetaData/JPEG/Segment.pm (update): dispatch to
2232 dump_app1 if necessary (new methods in Segment_dumpers.pl).
2233
2234 * lib/Image/MetaData/JPEG/Segment.pm (output_segment_data): fixed
2235 a bug in this method for zero-length comments. In fact, the data
2236 area of a segment can be void and, nonetheless, the segment might
2237 require a segment length word; in practise, the only segments not
2238 needing the length word are SOI, EOI and RST*. Test added.
2239
2240 * lib/Image/MetaData/JPEG/JPEG_app13.pl (get_IPTC_data): when the
2241 option is 'TEXTUAL' (i.e., use textual instead of numerical tags),
2242 if a numerical IPTC tag is not known, a custom textual tag is
2243 created with "Unknown_tag_" followed by the numerical value (this
2244 solves a bug with non-standard tags). What to do for set_IPTC_data?
2245
2246 * Renamed Image::MetaInfo::JPEG to Image::MetaData::JPEG.
2247
2248 2004-06-25 Stefano Bettelli <bettelli@localhost>
2249
2250 * Save current state as version 0.09
2251
2252 * lib/Image/MetaInfo/JPEG.pod: documentation updates, including
2253 a new introductory section on JPEG files and APP0.
2254
2255 * lib/Image/MetaInfo/JPEG/JPEG_app13.pl (provide_IPTC_subdirectory):
2256 corrected another bug here, thanks to testing.
2257
2258 * lib/Image/MetaInfo/JPEG/Segment.pm (update): simplified test
2259
2260 * lib/Image/MetaInfo/JPEG.pm (find_new_app_segment_position): bug:
2261 if there is a DHP(SOF) segment, return its position, not the
2262 position immediately after (because we are replacing there!)
2263
2264 * lib/Image/MetaInfo/JPEG.pm (parse_segments): don't have dataless
2265 segments saved in any case (setting $flag equal to undef for them
2266 was a bug! the logic is now a bit different).
2267
2268 * lib/Image/MetaInfo/JPEG.pm (new): this really returns undef when
2269 no error is set now (first "bug" catched with package testing!).
2270
2271 * t/JPEG_1_constructors.t: initial test set for JPEG ctors
2272 * t/JPEG_2_methods: initial test set for JPEG methods
2273 * t/JPEG_3_comments: initial test set for comment routines
2274 * t/JPEG_4_IPTC: initial test set for IPTC routines
2275 there is also a test photo in t/ using ~ 200Kb.
2276
2277 2004-06-24 Stefano Bettelli <bettelli@localhost>
2278
2279 * lib/Image/MetaInfo/JPEG.pm (save): changed to fail immediately
2280 if the "read_only" member is set (currently, only if the JPEG
2281 object is opened with the "FASTREADONLY" option).
2282
2283 * lib/Image/MetaInfo/JPEG.pm (new): there is now a third optional
2284 argument, $options. If it matches the string "FASTREADONLY", only
2285 those segments matching $regex are actually stored; also, everything
2286 which is found after a Start Of Scan is completely neglected. This
2287 allows for very large speed-ups, but, obviously, you cannot rebuild
2288 the file afterwards, so this is only for getting information fast,
2289 e.g., when doing a directory scan.
2290
2291 * lib/Image/MetaInfo/JPEG.pm (parse_segments, get_next_marker)
2292 (parse_ecs): updated to take the $this->{read_only} field into
2293 account. The new approach is the following: in general, all segments
2294 are read, saved and parsed if possible. If there is a regular
2295 expression argument to the ctor matching only a few segment names,
2296 only those segments are parsed (they are nonetheless saved). If
2297 $this->{read_only} is set (see FASTREADONLY later), the segments
2298 not selected for parsing are not even read and saved; moreover,
2299 everything after the SOS segment is neglected (this is for fast
2300 information retrieval).
2301
2302 * lib/Image/MetaInfo/JPEG.pm (get_data): this method returns a
2303 portion of the input file (specified by $offset and $length). It is
2304 necessary to mask how data reading is actually implemented. As usual,
2305 it dies on errors (but this is trapped in the constructor). This
2306 method returns a scalar reference; if $offset is just "LENGTH", the
2307 input length is returned instead.
2308
2309 * lib/Image/MetaInfo/JPEG.pm (open_input): this method, replacing
2310 "slurp_buffer", takes care to open a file handle pointing to the
2311 JPEG object specified by $file_input. If the "file name" is a
2312 scalar reference instead, it is saved in the "handle" member (and
2313 it must be treated accordingly in the following). Nothing is
2314 actually read now, only the handle is stored; this is needed for
2315 FASTREADONLY, see later. There is also a very short close_input().
2316
2317 2004-06-19 Stefano Bettelli <bettelli@localhost>
2318
2319 * Save current state as version 0.08
2320
2321 * lib/Image/MetaInfo/JPEG.pod: documentation update, including
2322 the description of a few "internals", to allow the curious user
2323 to access directly the result of the segments' parsing.
2324
2325 * lib/Image/MetaInfo/JPEG.pm (find_new_app_segment_position):
2326 this algorithm was changed. Now, if a DHP segment is present,
2327 the method returns the position immediately before the first DHP
2328 segment; otherwise, it tries the same with SOF segments; otherwise,
2329 it selects the position immediately after the last application
2330 or comment segment. If even this fails, it returns the position
2331 immediately after the SOI segment (i.e., 1).
2332
2333 2004-06-18 Stefano Bettelli <bettelli@localhost>
2334
2335 * lib/Image/MetaInfo/JPEG/JPEG_various.pl (get_app0_data):
2336 this method returns a reference to a hash with the content of
2337 the APP0 segments (a plain translation of the segment content).
2338 Segments with errors are excluded. Note that some keys may be
2339 overwritten by the values of the last segment, and that an empty
2340 hash means that no valid APP0 segment is present.
2341
2342 * lib/Image/MetaInfo/JPEG/JPEG_various.pl (get_dimensions):
2343 revised and commented. This method and get_description() are
2344 now in a separate file (JPEG_various.pl).
2345
2346 * lib/Image/MetaInfo/JPEG/JPEG_app13.pl (JPEG::set_IPTC_data):
2347 analogous to JPEG::get_IPTC_data; however, the segment is created
2348 and initialised with provide_app13_IPTC_segment if it is not
2349 there, so the segment retrieval should not fail.
2350
2351 * lib/Image/MetaInfo/JPEG/JPEG_app13.pl (JPEG::get_IPTC_data):
2352 this method is an interface to the method with the same name
2353 in the Segment class. First, the first IPTC APP13 segment is
2354 retrieved (if there is no such segment, the undefined value is
2355 returned). Then the get_IPTC_data is called on this segment
2356 passing the argument through.
2357
2358 2004-06-17 Stefano Bettelli <bettelli@localhost>
2359
2360 * lib/Image/MetaInfo/JPEG.pm (get_next_marker, parse_segments,
2361 parse_ecs): changed to work on in-memory buffers. This almost
2362 halves the system read time, but strangely increases the user
2363 run time, so there must be something I don't understand here.
2364 Note: ~40-55% processing time is spent in only two methods:
2365 slurp_buffer and parse_ecs (after a few optimisations).
2366
2367 * lib/Image/MetaInfo/JPEG.pm (new): the member storing a file
2368 handle is gone, but we have now a member storing a reference to
2369 the JPEG stream. The first argument of the ctor is the JPEG
2370 stream. The ctor saves the file stream as a private object,
2371 then it parses it and stores its sections internally. The stream
2372 can be specified in two ways: [a scalar] interpreted as a file
2373 name to be opened and read; [a scalar reference] interpreted as
2374 a pointer to an in-memory buffer containing a JPEG stream.
2375 This interface is similar to that of Image::Info, but no open
2376 file handle is accepted.
2377
2378 * lib/Image/MetaInfo/JPEG.pm (slurp_buffer): this method replaces
2379 the old check_file. It accepts just one argument: if it is a
2380 reference, it is assumed to point to a JPEG stream and saved
2381 internally; if it is a scalar, it is interpreted as a file name
2382 whose content is to be read into memory and treated as before.
2383 No test on SOI is performed.
2384
2385 2004-06-15 Stefano Bettelli <bettelli@localhost>
2386
2387 * lib/Image/MetaInfo/JPEG/Record.pm (get_description): non
2388 printable characters are now replaced with "\" followed by
2389 a two digit hexadecimal representation (it is shorter than
2390 a three digit octal representation!).
2391
2392 * Makefile.PL: arghh ... there was a "use 5.008004" also here!
2393
2394 * lib/Image/MetaInfo/JPEG/Segment_parsers.pl (parse_makernote):
2395 this new method is the entry point for parsing maker notes.
2396 It should be easy to extend it to all maker notes whose
2397 structure follows that of a regular IFD.
2398
2399 * lib/Image/MetaInfo/JPEG/Segment_parsers.pl (parse_app1_exif):
2400 if a Maker Note tag is found in the Exif SubIFD, then we should
2401 try to decode it. This is likely to fail, because most vendors do
2402 not publish their MakerNote format. However, if the note is
2403 decoded, the findings are written in a new subdirectory (currently
2404 I think it is wiser not to delete the unparsed MakerNote record).
2405
2406 * lib/Image/MetaInfo/JPEG/Segment_parsers.pl (parse_app1_exif):
2407 the "garbage" field in APP1 Exif and APP3 was removed, because
2408 it makes no sense (the IFDs structure is way more complicated
2409 than I though)!
2410
2411 2004-06-13 Stefano Bettelli <bettelli@localhost>
2412
2413 * lib/Image/MetaInfo/JPEG/Segment.pm (reparse_as): this new method
2414 re-executes the parsing of a segment after changing the segment
2415 nature (well, its name). This is very handy if you have a JPEG file
2416 with a correct application segment exception made for its name. I
2417 used it the first time for a file having an ICC_profile segment
2418 (usually in APP2) stored as APP13. Note that the name of the
2419 segment is permanently changed, so, if the file is rewritten to
2420 disk, it will be "correct".
2421
2422 * lib/Image/MetaInfo/JPEG/Segment.pm (parse): this new method
2423 contains the parse code once written inside the segment ctor.
2424 This allows the parsing to be rerun (the error message and the
2425 old parsed records are flushed at the beginning).
2426
2427 2004-06-12 Stefano Bettelli <bettelli@localhost>
2428
2429 * lib/Image/MetaInfo/JPEG/Segment_parsers.pl (parse_app2_ICC_tags) &
2430 (parse_app2_ICC_profiles): these new methods implement the parsing
2431 of APP2 ICC profiles (there is a subdirectory for the profile
2432 header and another subdirectory for the tag table). In Tables.pm
2433 there is a new hash table named %HASH_APP2_ICC.
2434
2435 * lib/Image/MetaInfo/JPEG/Segment_parsers.pl (parse_app2_flashpix):
2436 This method parses an APP2 Flashpix extension segment, and is not
2437 really reliable, since I have only one example and very badly
2438 written documentation. Moreover, I think that the FPXR format is
2439 the worst format I have ever seen.
2440
2441 * lib/Image/MetaInfo/JPEG/Segment_parsers.pl (parse_app2): this
2442 new method is the entry point for parsing APP2 segments.
2443
2444 * lib/Image/MetaInfo/JPEG/Segment_parsers.pl (parse_TIFF_header):
2445 the identifier length is now taken from $good_identifier, while
2446 before it was fixed to 6 bytes. A similar approach in parse_app1().
2447
2448 2004-06-12 Stefano Bettelli <bettelli@localhost>
2449
2450 * Save current state as version 0.07
2451
2452 * lib/Image/MetaInfo/JPEG.pod (Image): Documentation update
2453
2454 * lib/Image/MetaInfo/JPEG.pm (parse_segments): initialise
2455 $segments only once, at the beginning.
2456
2457 2004-06-10 Stefano Bettelli <bettelli@localhost>
2458
2459 * lib/Image/MetaInfo/JPEG/Record.pm: I gave up trying to calculate
2460 the length of a Perl reference. This is probably allocation and
2461 implementation dependent; so I use zero and change the logic
2462 where its length is used. This required trivial changes only in
2463 Record::new and Record::get_size (all other routines are unaffected
2464 so far, but this is a potential risk for the future ....)
2465
2466 2004-06-09 Stefano Bettelli <bettelli@localhost>
2467
2468 * The Image::MetaInfo::JPEG::Structure class is no more; it is
2469 now called simply Image::MetaInfo::JPEG (this is the package
2470 name). So, JPEG.pm and JPEG/Structure.pm were merged in
2471 lib/Image/MetaInfo/JPEG.pm, the documentation file moved
2472 lib/Image/MetaInfo/JPEG.pod and all other library files left
2473 in lib/Image/MetaInfo/JPEG/. The change was otherwise trivial.
2474
2475 * lib/Image/MetaInfo/JPEG.pm: commented "use 5.008004" out.
2476 I don't really know the Perl version requirements; maybe just
2477 Perl 5 is sufficient, but I don't know how to test it.
2478
2479 2004-06-07 Stefano Bettelli <bettelli@localhost>
2480
2481 * lib/Image/MetaInfo/JPEG/Structure.pm (new): There is now a second
2482 argument, $regex. This string is matched against segment names, and
2483 only those segments with a positive match are parsed. This allows
2484 for some speed-up if you just need partial information. For
2485 instance, if you just want to manipulate the comments, you could
2486 use $regex equal to "COM". If $regex is undefined, all segments are
2487 parsed. This required a change also in Structure::parse_segments.
2488 Remember that SOS segments are needed for get_dimensions().
2489
2490 * lib/Image/MetaInfo/JPEG/Segment.pm (new): there is now an
2491 optional third argument for the constructor, a flag. If this
2492 flag matches "NOPARSE", no parse routine is run in the segment
2493 constructor (this can be done by generating an informative error).
2494 This probably allows for some speed-up if we don't need the
2495 information stored in the segment.
2496
2497 * lib/Image/MetaInfo/JPEG/Structure_comments.pl (split_comment_string):
2498 corrected a terrible bug: $max_length is 2**16-3, not 2**16-2 !!!
2499
2500 * lib/Image/MetaInfo/JPEG/Segment.pm (set_data): this new method
2501 appends (or overwrites, if the second argument is "OVERWRITE")
2502 a string to the current segment data area. This hides the
2503 details of how the data area itself is implemented. The only
2504 four methods knowing explicitely about Segment::dataref should
2505 now be new, size, data and set_data.
2506
2507 * lib/Image/MetaInfo/JPEG/Segment.pm (output_segment_data): this
2508 new method replaces the old get_segment_data. It needs one argument
2509 more, a file handler, and it prints directly into it instead of
2510 returning a string; it returns the 1/0 in case the write succeeded/
2511 failed. Structure::save() needed an obvious update.
2512
2513 * lib/Image/MetaInfo/JPEG/Segment.pm (new): the second argument
2514 to a "new Segment" call is now a reference to a memory area, not
2515 directly a scalar, and it is saved in Segment::dataref, which
2516 replaces Segment::data. This makes passing a third argument clearer.
2517 Some trivial changes were needed in the Segment class (mostly
2518 transparent, since the access is mediated by Segment::data())
2519 and in the routines calling the Segment constructor (that is,
2520 in Structure.pm, Structure_app13.pl and Structure_comments.pl).
2521
2522 2004-06-07 Stefano Bettelli <bettelli@localhost>
2523
2524 * Save current state as version 0.06
2525
2526 * lib/Image/MetaInfo/JPEG.pm: prepared an initial POD file.
2527 This file is going to be the "official" documentation.
2528
2529 2004-06-06 Stefano Bettelli <bettelli@localhost>
2530
2531 * miserably replacing all occurrences of "retrive" with
2532 "retrieve" \Re*trieve"\ (thanks to my wife).
2533
2534 * COPYING: added a copyright notice to the beginning of this file.
2535 A shorter (3 lines) notice is present at the beginning of all files
2536 in lib. Maybe this will not be the final license scheme. See also
2537 the LICENSE files for license terms.
2538
2539 * MANIFEST: initial setup for a CPAN release, following the
2540 lines of "man perlnewmod". However, this still needs a lot of
2541 testing, so the package is still "private".
2542
2543 2004-06-04 Stefano Bettelli <bettelli@localhost>
2544
2545 * Structure_comments.pl (join_comments): this method now calls
2546 set_comment with the new behaviour, so it is safe against a
2547 very long joint comment.
2548
2549 * Structure_comments.pl (set_comment): this method now replaces
2550 the $index-th comment segment with one or more new segments
2551 based on the user string. If the string is too big, it is broken
2552 down and multiple segments are created. If the string is undef,
2553 the comment segment is erased. If $index is out-of-bound, only a
2554 warning is printed. This mimics the new behaviour of add_comment.
2555
2556 * Structure_comments.pl (add_comment): in case the passed string
2557 is too big (there is a 64KB limit in JPEG segments), it is broken
2558 down in smaller strings and multiple "Comment" segments are
2559 inserted in the file (they are contiguous). This replaces the
2560 previous behaviour of issuing a warning and trimming the string.
2561
2562 * Structure_comments.pl (split_comment_string): this new method
2563 splits a string into chunks which can fit in a comment segment.
2564 Note that "" maps to (""), while an undefined value maps to ().
2565 So, it is possible to specify an empty comment, and it is different
2566 from specifying an undefined comment. The comment_trim_string
2567 method is no longer necessary (removed).
2568
2569 * Segment.pm (Directory_Banner): simplified the string join
2570 and eliminated the string "Block " in the banner.
2571
2572 2004-06-01 Stefano Bettelli <bettelli@localhost>
2573
2574 * Segment_parsers.pl (parse_app3, parse_app1_exif, parse_ifd):
2575 code refactoring (some functionalities moved inside parse_ifd).
2576 This should make APP3 and APP1 parsing more readable.
2577
2578 2004-05-30 Stefano Bettelli <bettelli@localhost>
2579
2580 * Stupid changes using the comma operator in Segment.pm, Record.pm.
2581
2582 2004-05-29 Stefano Bettelli <bettelli@localhost>
2583
2584 * Segment_parsers.pl (parse_app12): the interpretation of the
2585 first line is now less ambitious, the line is simply saved in
2586 one ASCII field, named MakerInfo (it can contain null characters
2587 though). This prevents untold errors for APP12 segments whose
2588 format is really unknown (to me). I am still looking for docs.
2589
2590 * Segment_parsers.pl (parse_ifd): I used to complain in case no
2591 entry was present in the currently analysed IFD, but it turned
2592 out this is only annoying; so, the warning was removed.
2593
2594 * Structure.pm (save): modified the method description, to
2595 make it clear that "high level" methods (those implemented
2596 in the Structure_<segment name>.pl files) take care of calling
2597 update(), when needed, on their own. So, a user of the library
2598 should not care about calling update().
2599
2600 * Structure_comments.pl (join_comments): this method accepts now
2601 two arguments: ($separation, @selection). The first string is used
2602 between every two concatenated strings (it defaults to a newline,
2603 i.e., "\n"). The second argument is the old single argument.
2604 $separation is used as first argument of a join() call.
2605
2606 2004-05-05 Stefano Bettelli <bettelli@localhost>
2607
2608 * Save current state as version 0.0.5
2609
2610 * Structure.pm (save): This method writes the data area of each
2611 segment in the current object to a disk file. If the filename
2612 is undef, it defaults to the file originally used to create this
2613 Structure object. This method returns "true" (1) if it works,
2614 "false" (undef) otherwise.
2615
2616 * Structure_app13.pl (get_IPTC_data): implemented a rough XML
2617 translation for IPTC data. However, it would be more consistent
2618 to implement something on the lines of parse_app1_xmp().
2619
2620 2004-05-03 Stefano Bettelli <bettelli@localhost>
2621
2622 * Structure_app13.pl: this file contains a number of utilities
2623 for managing IPTC data without dealing with the details of the
2624 low level representation (although sometimes this means taking
2625 some decisions for the end user ....). The new methods are:
2626 Structure::retrieve_app13_IPTC_segment($index);
2627 Structure::provide_app13_IPTC_segment();
2628 Segment::is_app13_IPTC();
2629 Segment::retrieve_IPTC_subdirectory();
2630 Segment::provide_IPTC_subdirectory();
2631 Segment::remove_IPTC_subdirectory();
2632 Segment::get_IPTC_data($type);
2633 Segment::set_IPTC_data($data, $action);
2634
2635 * Structure.pm (get_segment): replaces get_segment_indexes. It
2636 returns segment references, not their indexes. However, the
2637 previous behaviour is restored if the second argument is "INDEXES".
2638 This requires some adjustments in the comment utilities file.
2639
2640 * Structure_comments.pl (add_comment): no need to call update
2641 at the end of this routine, thus removed.
2642
2643 * Structure.pm (find_new_app_segment_position): this new Structure
2644 method finds a position for a new application or comment segment
2645 to be placed in the file. If a SOS segment is present, it returns
2646 the position immediately before it; otherwise, it selects the
2647 position immediately after the last application or comment segment.
2648 If even this fails, it returns the position immediately after the
2649 SOI segment (i.e., 1). This affects also Structure::add_comment().
2650
2651 2004-05-02 Stefano Bettelli <bettelli@localhost>
2652
2653 * Record.pm (get_description) and Segment.pm (show_directory):
2654 eliminated the $tag_size/$width mechanism.
2655
2656 * (in all code base) replace "scalar @array" for "1+$#array",
2657 and "unless" for "if !" (still learning Perl).
2658
2659 2004-05-01 Stefano Bettelli <bettelli@localhost>
2660
2661 * Segment_dumpers.pl (dump_app13): this routine, together with
2662 dump_resource_data_block() and dump_IPTC_datasets(), can dump
2663 an APP13 segment (read, IPTC data, in particular).
2664
2665 * Segment_parsers.pl (parse_resource_data_block): corrected
2666 a bug (the padding byte is not part of the resource block name).
2667
2668 * Segment_parsers.pl (parse_unknown): non-printing characters
2669 are translated also here. Now, the output of get_description()
2670 for a Record object should not fool 'grep' into thinking that
2671 the output is binary.
2672
2673 * Record.pm (get_description): this method now reworks ASCII
2674 strings a bit before displaying them. In particular it trims
2675 unreasonably long strings and replaces non-printing characters
2676 [\000-\037\177-\377] with their octal representation. Note,
2677 however, that "more chars" counts each non-printing char as four.
2678
2679 * Segment_parsers.pl (parse_resource_data_block): non-IPTC
2680 records are now written in the root directory of an APP13
2681 segment, instead of the subdirectory "PHOTOSHOP_TAGS". This
2682 preserves the relative order with respect to the IPTC block.
2683 The parse_Photoshop_additional() method was removed. If
2684 there is a non-trivial record description, it is stored in
2685 the new "extra" field of the appropriate Record object.
2686
2687 * Segment.pm (search_record): introduced "reserved" keys in
2688 the record search routine: if $key is exactly "FIRST_RECORD"
2689 / "LAST_RECORD", the first/last record in the appropriate record
2690 list is returned.
2691
2692 * Record.pm (new): Added a new field, "extra", which can be
2693 used to store additional information one does not know where
2694 to put. The need originated from APP13 record descriptions.
2695 Record::get_description() was modified to show the field.
2696
2697 2004-04-30 Stefano Bettelli <bettelli@localhost>
2698
2699 * Tables.pm (enum): removed all "custom" numeric-to-textual
2700 translations in %JPEG_RECORD_NAME. In fact, given that
2701 Record objects now accept a non-numeric tag, these names
2702 can be written directly into the code.
2703
2704 * Segment.pm (search_record): this new method is modelled on
2705 search_value_by_key (which can now be safely removed), but it
2706 returns a reference to the first occurrence of a record with
2707 a given key (this is handy for dumper routines).
2708
2709 * Record.pm (set_value): this new method allows the modification
2710 routines not to deal with Record objects internals.
2711
2712 * Record.pm (get): this new method is the "inverse" of the
2713 constructor (but it does not erase the record content). In
2714 list context, it returns the following list: ($key, $type, $count,
2715 $dataref). In scalar context it returns $$dataref (note the
2716 dereferentiation). This is tricky (but handy).
2717
2718 2004-04-27 Stefano Bettelli <bettelli@localhost>
2719
2720 * Record.pm (extract): reorganisation + comments. extract() is
2721 renamed as decode(), and the inverse function is provided
2722 under the name of encode(). Massive use of map. Danger!
2723
2724 2004-04-26 Stefano Bettelli <bettelli@localhost>
2725
2726 * Save current state as version 0.0.4
2727
2728 * Record.pm (get_description): the ASCII description of a
2729 record does not require an entry in the hash tables provided
2730 by Tables.pm. If such an entry does not exist, a default label
2731 is provided. This allows me to drop a lot of undocumented or
2732 illegal entries in the aforementioned tables. What to do with
2733 this kind of records is still to be decided.
2734
2735 * Record.pm: the length of an anonymous array reference is
2736 now calculated (it was fixed to 16), because I suspect it can
2737 change in other versions of Perl, as reported by Martin.
2738
2739 2004-04-25 Stefano Bettelli <bettelli@localhost>
2740
2741 * Segment_parsers.pl (parse_app3): double count for garbage
2742 bytes corrected in the last garbage test.
2743
2744 * Segment_parsers.pl: all references to $this->{parsed}
2745 removed. In fact, if a segment remains with $this->{error}
2746 undefined, it is to be considered correctly parsed.
2747 Also, all informative messages which are not at error level
2748 are now treated with "warn", not "print".
2749
2750 * Segment.pm (Directory_Banner): now a simple subroutine.
2751
2752 * Segment.pm (get_description): Segment_Banner suppressed and
2753 its functionality inserted directly in this method, which can
2754 now show also any error condition occurred during the segment
2755 construction in the parsing stage (now all segments are shown).
2756
2757 * Segment.pm (update): consistently with the previously stated
2758 policy, a segment with errors ($this->{error} not undefined)
2759 cannot be updated (so, it must be rewritten to disk as it is).
2760
2761 * Segment.pm (new): new error handling strategy also for JPEG
2762 segments and underlying classes. The parsing routines in the
2763 constructor of a segment are now executed in an eval block;
2764 if any error occurs (in the Segment or Record class, which in
2765 turn implies that parsing was interrupted at some point and is
2766 therefore incomplete) the "error" member of the relevant segment
2767 object is set to a meaningful error message. If no error occurs,
2768 the same variable is left undefined. The reference to the segment
2769 object is returned in any case. In this way, a "faulty" segment
2770 cannot inhibit the creation of a Structure object; faulty segments
2771 should in no case be edited/modified, basically because their
2772 structure could not be fully understood. They can anyway be
2773 rewritten to disk untouched, so that a file with corrupted or
2774 non-standard segments can be partially edited without fear of
2775 destroying it. $this->{parsed} was suppressed.
2776
2777 * Structure.pm (new): new error handling strategy. If there is
2778 an irrecoverable error in the constructor of a Structure object,
2779 the ctor returns undef and an error message can be retrieved
2780 with Image::MetaInfo::JPEG::Structure::Error(). This works
2781 by executing the parsing subroutines in the ctor in an eval
2782 block, and then checking the value of $@. In this way the
2783 creation of an Image::MetaInfo::JPEG::Structure object is
2784 similar to the creation of an Image::IPTCInfo object.
2785
2786 2004-04-22 Stefano Bettelli <bettelli@localhost>
2787
2788 * Segment_parsers.pl (parse_app1_exif): contrary to my belief,
2789 there exist IFD0 sections without a SubIFD pointer. Indeed,
2790 the whole IFD0 section can contain no fields at all. I modified
2791 the code so that it does not abort if the link is not present.
2792
2793 * Segment_parsers.pl (parse_app1_exif): some pictures declare
2794 they have a thumbnail, but there is no thumbnail link for it
2795 in the following of the 1st IFD. This case is now treated
2796 gracefully, without trying to access the undefined link.
2797
2798 2004-04-19 Stefano Bettelli <bettelli@localhost>
2799
2800 * Structure_comments.pm: this new file contains those functions
2801 which deal with comment segments in the files. It is loaded by
2802 Structure.pm, and contains the following functions:
2803 Structure::get_comments(),
2804 Structure::get_number_of_comments(),
2805 Structure::add_comment($string),
2806 Structure::set_comment($index, $string),
2807 Structure::remove_comment($index),
2808 Structure::remove_all_comments(),
2809 Structure::join_comments($separation, @selection).
2810
2811 * Structure.pm (get_segment_indexes): this new method returns
2812 a list of indexes pointing to segments matching a given condition.
2813
2814 * Structure.pm (show): this method (and its supporting methods
2815 in the lower level classes) were renamed as get_description().
2816 They now return a string instead of printing to standard output.
2817
2818 2004-04-18 Stefano Bettelli <bettelli@localhost>
2819
2820 * Tables.pm (enum): Introduced three unknown tags (231, 232, 240)
2821 in the HASH_IPTC_RECORD_2 hash (found in a "Canon EOS-1D" image).
2822 The treatement of these unknown/non-standard tags should be unified.
2823
2824 2004-03-17 Stefano Bettelli <bettelli@localhost>
2825
2826 * Save current state as version 0.0.3
2827
2828 * Added a basic copyright notice based on GPL 2.
2829
2830 * Segment_dumpers.pl (dump_com): this file will contain routines
2831 which dump segment records into the segment internal data area.
2832 The simplest routine is for comment blocks.
2833
2834 * package names changed to Image::MetaInfo::Jpeg::X, where
2835 X is /Structure|Segment|Record|Tables/; the "highest level"
2836 package is "Structure".
2837
2838 * Segment.pm: all segment specific parsing routines are now in
2839 a separate file (Segment_parsers.pl), which is "required" in
2840 the main package file (which was already ~ 100kB).
2841
2842 2004-03-17 Stefano Bettelli <bettelli@localhost>
2843
2844 * Save current state as version 0.0.2
2845
2846 * Tables.pm: new variable ($VERSION) for package version
2847
2848 * Segment.pm (get_segment_data): this routine dumps the content
2849 of a segment into a scalar (this includes the segment preamble,
2850 that is 0xff, the segment marker and the segment data word).
2851 The data area is read from $this->{data}, not from the parsed
2852 records (one should provide other routines for storing, segment
2853 per segment, the [possibly modified] records into $this->{data}).
2854
2855 * Segment.pm (parse_app1_xmp): this routine contains the simplest
2856 XML parses able to parse Adobe XMP packets (at least I hope). The
2857 layout of parsed records is a bit complicated, but this is the way
2858 XML works (I should be able to reconstruct the full XMP packet
2859 from this layout, comment excluded, at least I think).
2860
2861 2004-03-15 Stefano Bettelli <bettelli@localhost>
2862
2863 * Tables.pm (enum): deleted the GPS prefix from GPS tag names.
2864 Added all TIFF 6.0 tags which are not Exif 2.2 tags to the
2865 %HASH_APP1_IFD hash, and also looked at tiff.h of libtiff for
2866 some other vendor specific tags.
2867
2868 * Segment.pm (parse_app3): simplified, with the same trick
2869 as for parse_app1_exif (i.e., the update_offset_and_garbage
2870 local subroutine). This can be done better ...
2871
2872 * Segment.pm (parse_app12): the routine parsing an APP12 segment
2873 is now more refined and readable; however, I don't have any
2874 documentation about this format, and only one example so far, so
2875 parse_app12 should be considered highly experimental.
2876
2877 2004-03-14 Stefano Bettelli <bettelli@localhost>
2878
2879 * Segment.pm (new): Deleted the "dirs" member in a JPEG::Segment
2880 object. There is now a new way to store properties in a segment.
2881 $segment->{records} gives access to a list of JPEG::Records; most
2882 of them contains segment properties (key-value pairs), but some
2883 are REFERENCE records: for these records, the key is a string
2884 carrying the name of a sub-directory, and the value is a reference
2885 to this sub-directory, whose structure is the same as for
2886 $segment->{records}. This mechanism replaces the $this->{dirs}
2887 hash, and is more flexible. Have a look at JPEG::Segment::show()
2888 for more details on how to inspect this structure. For instance,
2889 in APP1 and APP3 there are the following trees:
2890
2891 /--APP1--\ APP3
2892 / \ |
2893 /--IFD0--\ IFD1 /--IFD0--\
2894 / \ / \
2895 SubIFD GPS Borders Special
2896 |
2897 Interop
2898
2899 * Record.pm (show): change the test for numeric/non-numeric
2900 tags from $descriptor =~ /\d/ to $descriptor =~ /^\d*$/.
2901
2902 2004-03-13 Stefano Bettelli <bettelli@localhost>
2903
2904 * Segment.pm (store_record): a list reference can now be prepended
2905 to the argument list; in this case it is used instead of
2906 $this->{records}. This means that store_record can now be
2907 used instead of an explicit push also for "subdirectories"
2908 (provide_subdirectory): this new method searches (creates if
2909 absent) a REFERENCE record (an internal record linking to a
2910 subdirectory) and returns its value (the actual reference).
2911 The record can be inserted in any record list, and defaults
2912 to the main record list $this->{records}.
2913 (search_value_by_key): this now works as provide_subdirectory,
2914 i.e., the second argument is an optional record list reference.
2915
2916 * Record.pm (show): change the prototype; now the second
2917 argument is a reference to a list of names, to be used as
2918 successive keys in the JPEG_RECORD_NAME hash to find the
2919 description of a numeric key. No argument is needed if the
2920 key is non-numeric. This allows for more flexibility and
2921 deeper structures. Other small cosmetic changes.
2922
2923 * Segment.pm (show): change the test from (defined $this->{parsed})
2924 into ($this->{parsed} eq "ok") [this was a bug]
2925 (show_directory): this new method prints all records in a given
2926 record directory. It is called initially by show(), and can call
2927 itself when it finds a record containing a reference to another
2928 record list (this supersedes the old sub-directory mechanism).
2929
2930 * Segment.pm (search_value_by_key): changed order of arguments.
2931 Now $dir is the second argument; if it is defined it looks in
2932 $this->{dirs}{$dir}, otherwise it looks in $this->{records}
2933
2934 * Record.pm (new): added a "reference" type for records. This
2935 type will be used only internally to link to subdirectories.
2936 The show() method and the Tables..pm file needed to be updated.
2937
2938 2004-03-12 Stefano Bettelli <bettelli@localhost>
2939
2940 * Save current state as version 0.0.1
2941
2942 * Segment.pm (parse_app1_exif): sometimes, we have broken pictures
2943 with a thumbnail in APP1 with an actual size which is shorter than
2944 the predicted size; nonetheless, the thumbnail is often valid, so
2945 this case deserves only a warning if the difference is not too
2946 large (currently, 1 byte).
2947
2948 2004-03-06 Stefano Bettelli <bettelli@localhost>
2949
2950 * Segment.pm (create_record, read_record, store_record):
2951 The data reading routines have been revolutionised in order to
2952 be simpler, less, and more uniform. Their prototypes:
2953 -----------------------------------------------------------
2954 create_record(tag, type, dataref/offset, count)
2955 [returns a record reference]
2956 read_record ( type, dataref/offset, count)
2957 [returns reference->get_value()]
2958 store_record (tag, type, dataref/offset, count)
2959 [inserts + returns record reference]
2960 -----------------------------------------------------------
2961 (get_last_record_value), as a consequence could be dropped and
2962 many other methods needed to be updated to reflect the new
2963 prototypes. In particular, all direct calls to the JPEG::Record
2964 constructor have been replaced by create_record.
2965
2966 * Record.pm (new): The arguments of a record constructor
2967 are now: (key, type, dataref, count, endiannes). Other internal
2968 methods have been updated accordingly (extract).
2969
2970 * Segment.pm (data): access to a substring of $this->{data}
2971 is now mediated by this method.
2972
2973 2004-03-05 Stefano Bettelli <bettelli@localhost>
2974
2975 * Deleted all "Aborting ...\n" in 'die' statements, because
2976 it is obvious and because showing the index of the error
2977 causing line is better (and code is shorter ...)
2978
2979 * Segment.pm (new): added a private transient member which
2980 stores the "current" endianness value; this is only meaningful
2981 during the parsing routines, and it is reset to undef at the
2982 end of the constructor. This change gets rid of a very tedious
2983 parameter to be passed all around.
2984
2985 * Record.pm (get_size): the logic for calculating the memory
2986 footprint of a record is now in this class static method.
2987 Moreover, some details have been abstracted in local variables
2988 and @JPEG_RECORD_TYPE_LENGTH is now private in the record class.
2989 Some copies dropped in favour of using references.
2990
2991 2004-03-01 Stefano Bettelli <bettelli@localhost>
2992
2993 * Segment.pm (search_value_by_key): return as soon as a matching
2994 key is found (identical keys are an error anyway!)
2995
2996 * Segment.pm (get_last_record_value,add_record,search_value_by_key)
2997 use references instead of copying arrays (at least, I hope this
2998 is the effect of using @$refname instead of @{$refname}.
2999
3000 2004-02-27 Stefano Bettelli <bettelli@localhost>
3001
3002 * replaced computed gotos in Record.pm with ifs for portability.
3003 More robust parsing of IPTC/NAA data. Added parsing of APP3 and
3004 APP14. Preliminary work on APP12 and XML meta-data in APP1.
3005
3006 2004-02-04 Stefano Bettelli <bettelli@localhost>
3007
3008 * Initial code, with splitting of JPEG sections and parsing of
3009 COM, APP0, APP1, APP13 (just a try), DQT, DHT, SOF_n and SOS. Only
3010 showing the parsed tags is supported. Files: Record.pm, Section.pm,
3011 Structure.pm, Tables.pm
3012
3013 Revision history for Perl extension Image::MetaInfo::JPEG.
3014
3015 ### Local Variables: ***
3016 ### fill-column:75 ***
3017 ### ispell-dictionary: "british" ***
3018 ### add-log-mailing-address: "[email protected]" ***
3019 ### End: ***