Hi all,
I have lots of photos in ".jpg" and ".png".
The photos have filename based on the right photo time like "2012-02-12 19.52.52.jpg" or "2012-02-04 23.59.54.png".
(1) for jpg
Now I can change the EXIF time for jpg by code: exiftool "-datetimeoriginal<filename" -d "%Y-%M-%D %H.%M.%S.%%e" ./
Also I tried to change modify time and creation time by file name, however my filename format is not "YYYYmmdd_HHMMSS"
so the code exiftool "-AllDates<filename" * does not work is there any way without change file name format first?
(2) for png
I tried to change the modify time or creation time for png, and I referenced this article https://exiftool.org/forum/index.php?topic=8831.0
the suggestion code exiftool "-PNG:CreationTime<{filename;s/(\d{4})-(\d\d)-(\d\d) (\d\d).(\d\d).(\d\d).*/$1:$2:$3 $4:$5:$6/}" does not work for me.
I am not sure if it causes by the new version.
Could anyone give some ideas for this. Any suggestion is appreciated!
Thanks!
Atai
Sorry, Im reading many times, but cannot understand the question inside '(1) for jpg' ????
But for png its just looking like typo, because it should look like.... ${filename;
Edit: For the jpegs, to use something like -AllDates"<${Filename; s/YourFormat/GoodFormat/}" but this impossible to advise without knowing YourFormat.
Example: if YourFormat was like mm-dd-YYYY HH.MM.SS, then to use something like...
-AllDates"<${Filename;s/.*(\d\d)-(\d\d)-(\d\d\d\d) (\d\d)\.(\d\d)\.(\d\d).*/$3$1$2 $4$5$6/}"
Quote from: Atai Lo on April 08, 2021, 02:13:50 AM
The photos have filename based on the right photo time like "2012-02-12 19.52.52.jpg" or "2012-02-04 23.59.54.png".
...
however my filename format is not "YYYYmmdd_HHMMSS"
so the code exiftool "-AllDates<filename" * does not work is there any way without change file name format first?
I don't understand. Both your examples have Year Month Day Hour Minutes Seconds in the proper order. As per FAQ #5 (https://exiftool.org/faq.html#Q5), all you need is
exiftool "-alldates<filename" c:\imagesUse of the
-d (dateFormat) option (https://exiftool.org/exiftool_pod.html#d-FMT--dateFormat) is unnecessary.
For PNGs, you just need to add
-PNG:CreationTime<FilenameExample output
C:\>exiftool -P -overwrite_original "-AllDates<Filename" "-PNG:CreationTime<Filename" Y:\!temp\ccccc\p
1 directories scanned
2 image files updated
C:\>exiftool -time:all -G1 -a -s Y:\!temp\ccccc\p
======== Y:/!temp/ccccc/p/2012-02-04 23.59.54.png
[File] FileModifyDate : 2020:04:28 19:27:38-07:00
[File] FileAccessDate : 2020:04:28 12:30:38-07:00
[File] FileCreateDate : 2020:04:28 12:30:38-07:00
[PNG] CreationTime : 2012:02:04 23:59:54
[PNG] CreateDate : 2012:02:04 23:59:54
[PNG] ModifyDate : 2012:02:04 23:59:54
[EXIF] ModifyDate : 2012:02:04 23:59:54
[EXIF] DateTimeOriginal : 2012:02:04 23:59:54
[EXIF] CreateDate : 2012:02:04 23:59:54
======== Y:/!temp/ccccc/p/2012-02-12 19.52.52.jpg
[File] FileModifyDate : 2016:06:03 22:29:58-07:00
[File] FileAccessDate : 2020:08:30 09:06:08-07:00
[File] FileCreateDate : 2020:08:30 09:06:07-07:00
[EXIF] ModifyDate : 2012:02:12 19:52:52
[EXIF] DateTimeOriginal : 2012:02:12 19:52:52
[EXIF] CreateDate : 2012:02:12 19:52:52
1 directories scanned
2 image files read
As you can see, all the tags affected by
AllDates (
CreateDate/
DateTimeOriginal/
ModifyDate, see
AllDates entry on the Shortcut tag page (https://exiftool.org/TagNames/Shortcuts.html)) have been updated and the
PNG:CreationTime has also been updated in the PNG file.
To StarGeek
I use the code exiftool "-PNG:CreationTime<Filename"
then the png file got the creation time from filename
thanks a lot!!!