Closed LordCatzorz closed 3 years ago
The tag reference documentation shows which metadata fields are set by each Photini item. I'm using the most widely used fields and following guidance from the "Metadata Working Group", a former industry group with representatives from all the major camera & software companies. https://photini.readthedocs.io/en/latest/manual/tags.html
I don't know where your Windows example is getting the "date taken" field from. If you run an MSYS2 command window you might be able to run exiv2 -pa IMG_20201017_0001.jpg
to see all the metadata values in the file.
I went into my Linux machine and here's the result of exiv2 -pa IMG_20201017_0001.jpg
Exif.Image.ProcessingSoftware Ascii 25 Photini editor v2020.4.0
Exif.Image.Make Ascii 6 Canon
Exif.Image.Model Ascii 20 Canon MB5000 series
Exif.Image.Orientation Short 1 right, top
Exif.Image.XResolution Rational 1 600
Exif.Image.YResolution Rational 1 600
Exif.Image.ResolutionUnit Short 1 inch
Exif.Image.Software Ascii 16 IJ Scan Utility
Exif.Image.DateTime Ascii 20 2020:10:17 12:03:49
Exif.Image.YCbCrPositioning Short 1 Centered
Exif.Image.ExifTag Long 1 250
Exif.Photo.ExifVersion Undefined 4 2.21
Exif.Photo.DateTimeDigitized Ascii 20 2020:10:17 12:03:49
Exif.Photo.ComponentsConfiguration Undefined 4 YCbCr
Exif.Photo.FlashpixVersion Undefined 4 1.00
Exif.Photo.ColorSpace Short 1 sRGB
Exif.Photo.PixelXDimension Short 1 2032
Exif.Photo.PixelYDimension Short 1 2624
Exif.Thumbnail.Compression Short 1 JPEG (old-style)
Exif.Thumbnail.Orientation Short 1 top, left
Exif.Thumbnail.XResolution Rational 1 600
Exif.Thumbnail.YResolution Rational 1 600
Exif.Thumbnail.ResolutionUnit Short 1 inch
Exif.Thumbnail.JPEGInterchangeFormat Long 1 466
Exif.Thumbnail.JPEGInterchangeFormatLength Long 1 3066
Iptc.Envelope.CharacterSet String 3
Iptc.Application2.DigitizationDate Date 8 2020-10-17
Iptc.Application2.DigitizationTime Time 11 12:03:49+00:00
Iptc.Application2.Program String 14 Photini editor
Iptc.Application2.ProgramVersion String 8 2020.4.0
Iptc.Application2.DateCreated Date 8 1980-00-00
Xmp.xmp.CreateDate XmpText 19 2020-10-17T12:03:49
Xmp.xmp.ModifyDate XmpText 19 2020-10-17T12:03:49
Xmp.photoshop.DateCreated XmpText 4 1980
My guess would be Exif.Image.Datetime.
If you prefer not to modify Photini for this purpose, I might be able to script my need. I'll just need a bit of research to find the command I need.
That's very strange - Photini should have saved 1980 in Exif.Photo.DateTimeOriginal
, but it hasn't. The Iptc and Xmp data has it though. Have you installed on Windows with the latest installer? If so, I should be able to test this with the same MSYS2 version of libgphoto2. I won't have time to look into it until Monday though.
I have uninstalled my version of Photini and resinstall it using the photini-win64-2020.10.0.exe
in https://github.com/jim-easterbrook/Photini/releases/tag/2020.4.0-win
Same problem.
I've also changed the date for 2010-01-01, to be sure it was not a problem with the date being to far in the past. Still didn't work.
By sliding the precision to the max and linking everything together, Exif.Photo.SubSecTimeOriginal
did appear, but strangely not the corresponding Exif.Photo.DateTimeOriginal
Definitely a bug somewhere. Leave it with me and I'll try to find out what's going on. (I've never seen this problem on Linux, but I'll check it as well anyway.)
I've managed to reproduce the problem, on Linux as well as Windows, and have found the cause. I can't believe I didn't find the problem before. Commit f1ac8c4 fixes it, but I've found a bug in the display of reduced precision dates I need to fix before doing a new release.
Another reason I didn't spot the problem (for over a year!) is that I don't usually change the take taken field. I haven't scanned any of my old slides recently. New release 2020.11.0 should fix the problem.
Alright! Awesome findings!
Thanks for creating and maintaining this project. I'll pause my scanning's effort for the moment. There is no level on urgency for my project :)
I feel embarrassed to have made (and not corrected) such a fundamental error. Thanks for drawing it to my attention. No need to pause, the new release is available now. https://photini.readthedocs.io/en/latest/other/installation.html#upgrading-all-in-one-installation
The problem is actually worse than I thought. It affects all files saved by Photini versions 2019.10.0 to 2020.10.1. Here is a simple script to correct picture files. Save it as fix_exif_datetime.py
(or similar) and run it from a MinGW command shell with python3 fix_exif_datetime.py directory
where directory
is a directory with picture files in it, for example python3 fix_exif_datetime.py /c/Users/Jim/Pictures/2020
. The script walks through all subdirectories, so you could do all your pictures in one go. There is also a -d
option to show which files would be changed but not make any changes.
import mimetypes
from optparse import OptionParser
import os
import sys
import time
from photini.metadata import Metadata
def process_file(path, options):
mime_type = mimetypes.guess_type(path)[0]
if mime_type and not mime_type.startswith('image'):
return
md = Metadata(path)
if not md._if:
return
exif_tags = md._if.get_exif_tags()
if md._sc:
exif_tags += md._sc.get_exif_tags()
if 'Exif.Photo.DateTimeOriginal' in exif_tags:
return
if 'Exif.Image.DateTimeOriginal' in exif_tags:
return
xmp_tags = md._if.get_xmp_tags()
if md._sc:
xmp_tags += md._sc.get_xmp_tags()
if 'Xmp.photoshop.DateCreated' not in xmp_tags:
return
print(path)
time.sleep(1)
if options.dry_run:
return
file_times = os.path.getatime(path), os.path.getmtime(path)
md.dirty = True
md.save(file_times=file_times)
def main(argv=None):
if argv:
sys.argv = argv
parser = OptionParser(
usage='Usage: %prog [options] [file_name, ...]',
description='Photini Exif datetime corrector')
parser.add_option(
'-d', '--dry-run', action='store_true',
help="don't modify files")
options, args = parser.parse_args()
for arg in args:
if os.path.isdir(arg):
for root, dirs, files in os.walk(arg):
dirs.sort()
for name in sorted(files):
process_file(os.path.join(root, name), options)
elif os.path.isfile(arg):
process_file(arg, options)
return 0
if __name__ == "__main__":
sys.exit(main())
Don't blame yourself for such error.
As you said, it was not a use case you've used your software for.
I, too, only saw this problem once I wanted to push my scans to Google Photo and was disappointed to see them all at the top.
There may be a time where this software will gain lots of traction and it's user base grows. Then, some problems may be found sooner by the mass of users and all their specific use case.
I'll checkout your script once I'm home. I appreciate a lot your devotion to help me out on this issue.
Thanks, it works and Google Photos takes the new dates correctly (at least, for some photos I tested).
I had a single image on 200 that had an error in the conversion. I had a date of 1981-04 and this error appeared IMG_20201017_0004.jpg(date_modified): ignored Xmp.xmp.ModifyDate "2020-10-17T12:03:52"
Google Photo did not take the image either, but I think Microsoft Windows Photo Viewer messed up with it a bit, so I don't think it's your software's fault.
Anyway, I'll go ahead and close this issue.
Thanks for everything.
The "ignored Xmp.xmp.ModifyDate" warning is probably irrelevant. Photini compares the information in Exif, Xmp and Iptc and resolves conflicts as best as it can. (For text stuff you may have seen //
used as a separator between parts that have been merged from different fields.) In the case of conflicting dates it means one of them has to be ignored, hence the warning. Windows Photo Viewer probably changed Exif but not Xmp.
When setting a date taken using the Technical metadata tab, I expected it to have an effect on the "Date Taken" field when I right-click->properties->Details the image.
This is the field that Google Photo uses to order the images.
Could you consider changing this field when setting the "Taken" field? For the precision, you can always revert to XXXX-01-01 00:00:00.
Using Photini for Windows version 2020.4.0 build 1484 (5c0423b)