Resolving maker notes offset problems

Started by agill, March 08, 2014, 06:02:49 PM

Previous topic - Next topic

agill

Being new to exiftool and this forum, I'm not too sure if this kind of post is appropriate, so please let me know if not. But having worked through and successfully resolved the problem without having to ask for help, I thought it may prove useful to others.

Problem - unable to change date tags on images from a Pentax
I just recently brought a 10+ year old Pentax Optio 550 point and shoot back into service, but when I set it up mistakenly made the year 2013 instead of 2014. When I downloaded the images from it, they represented that in the following date tags:
[IFD0]      ModifyDate               : 2013:01:20 11:53:36
[ExifIFD]  DateTimeOriginal      : 2013:01:20 11:53:36
[ExifIFD]  CreateDate               : 2013:01:20 11:53:36
[Pentax]  Date                          : 2013:01:20

I tried using exiftool to correct these dates, but kept receiving the same error message, e.g. specifying the following:
   exiftool -ModifyDate+="1:: 0" IMGP0001_20140120_copy.JPG

(adding 1 to the year, ignoring the month and day via "::", and the time via "0")

Exiftool returned:
Warning: [minor] Ignored 4 invalid entries from MakerNotes - IMGP0001_20140120_copy.JPG
Error: [minor] MakerNotes offsets may be incorrect (fix or ignore?) - IMGP0001_20140120_copy.JPG
    0 image files updated
    1 files weren't updated due to errors

I felt sure the command format was correct, so tried it on an image I'd taken with a Canon DSLR, where it worked perfectly.

Resolution
Being new to both exiftool and the concept of adjusting image metadata, I wasn't sure what to do at that point, but researched on the exiftool forum until I worked out what was happening. Basically the offsets for the date tags I was trying to edit were incorrect on the Pentax images, or at least not what exiftool expected.

The area in the forum that gave me the most help was this FAQ entry - http://www.exiftool.org/faq.html#Q15
From that I could work out that exiftool could adjust for the "odd" offsets, and that as the problem was with an image direct from the camera (no other processing), the likely best way to make the adjustment was by using the -m option.

I experimented with that on the Mac's Terminal command line, checking all metadata entries before and after to ensure the change was made, and nothing lost.

Here's an example on a single image of the command that worked -
   exiftool -ModifyDate+="1:: 0" -m  IMGP0001_20140120_copy.JPG

I used the above on this image with each of the 4 date tags I needed to change individually, and note that the first 3 worked fine, but the final one, "[Pentax]   Date" worked with a warning message as follows:

Warning: Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in XMP-dc:Date (PrintConvInv)
    1 image files updated

I tried various changes to the exiftool command to remove this warning even though it wasn't strictly necessary to do so as the updates were made correctly. I'm not comfortable with warnings however, and it was part of the learning process. I even excluded all time information as it seemed to only be a date tag, but the same warning kept being returned.
What finally worked with this tag was to define the time as well as the date, and explicitly exclude hours/minutes/seconds as follows:
   exiftool -Date+="1:: 0:0:0" -m IMGP0001_20140120_copy.JPG

Additional Info
To check at any point that only the required dates were changed and other metadata left intact, I used the following to output metadata to a text file I could then read -
   exiftool -a -s -u -n -G1 -w! %d%f_meta.txt IMGP0001_20140120_copy.JPG

where:
-a allows duplicate tags to be extracted
-s (short) gives the tag name instead of its description
-u gives unknown tags
-n reads/writes values as numbers not words (not converted to human readable)
-G1 sorts by group (for family 1) giving group name by tag
-w! writes (allowing overwrite with the exclamation) an output file
%d%f_meta.txt enables the file name to be taken from the input file to generate a text output file of the same name in the same directory, but with _meta.txt appended. Using the filename of the image above, the output file would be IMGP0001_20140120_copy_meta.txt.

Having made it work with one date tag, I combined all 4 required date tag changes into one command -
   exiftool -ModifyDate+="1:: 0" -DateTimeOriginal+="1:: 0" -CreateDate+="1:: 0" -Date+="1:: 0:0:0" -m IMGP0001_20140120_copy.JPG

That worked with no problems, so I built it into the Run Shell Script portion of an Automator app as follows:
for f in "$@"
do
  exiftool -ModifyDate+="1:: 0" -DateTimeOriginal+="1:: 0" -CreateDate+="1:: 0" -Date+="1:: 0:0:0" -m "$f"
done

This enabled me to run Automator as a GUI to select multiple files/folders against which to change these 4 date tags - see https://exiftool.org/forum/index.php/topic,5651.0.html for more details about how to execute exiftool from within Automator.

This worked perfectly, enabling me to correct the year the photos were taken for each image in the folders I selected.

Phil Harvey

Thanks for this detailed account.  I am sure it will be useful for someone.

The warning you get about XMP-dc:Date may be bypassed by targeting the specific Date tag that you are interested in (in this case, Pentax:Date).  You can add the -v2 option to see what tags that ExifTool is trying to write to the file.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

agill

Thanks for the tip about using -v2 and targetting the specific Date tag - I'll try that in future,
Adrian