I) Use ImageMagick to perform the batch processing from PNG to JPG while preserving the timestamp:
mogrify -verbose -define preserve-timestamp=true -format jpg -quality 60% -path ./output/ ./input/*.png
preserve-timestamp
correctly preserves the creation and modification timestamps in the filesystems.- But in the EXIF header timestamps are NOT created!
- As I read in a forum post from 10/2018 writing EXIF metadata seems not to be in the scope of ImageMagick.
- Hence the use of another tool:
- As I read in a forum post from 10/2018 writing EXIF metadata seems not to be in the scope of ImageMagick.
- Hence the use of another tool:
II) Use ExifTool to copy the creation date in the filesystem to the creation and modification date in the filesystem and into the EXIF header of the file.
exiftool "-alldates<filecreatedate" -overwrite_original_in_place -P ./output/
III) As of exiftool 12.26 on macOS 11.4 Big Sur (ca. 08/2021) the above results in a bug which I reported like this:
- ✅ The EXIF timestamp is written correctly
overwrite_original_in_place
causes that this remains the same file, hence the creation date stays as-is. - ❌ But
-P
preserves the creation and modification timestamps intimestamp of the filesystem get set to noworiginal file which is overwritten in place. - So one more processing task:
- In another tool which can copy timestamps between EXIF and the filesystem such as A Better Finder Attributes:
- Copy EXIF timestamp to creation timestamp.
- Copy creation to modification timestamp.
- (Or in one pass if the software supports it.)
-alldates
. - In another tool which can copy timestamps between EXIF and the filesystem such as A Better Finder Attributes: