How can I set a PNG's "Date Taken" from its filename using ExifTool?

Asked 1/10/2017

9 views

2 answers

0

I have PNG files from a baby monitor named in the format yyyymmdd_hhmmss.png, but they don't contain a capture date. In Windows Explorer and Lightroom, the "Date Taken" field is blank.

I want to use ExifTool to write the correct date/time into the PNG metadata based on the filename so the files sort properly. What tag should I write for PNG files, and what ExifTool command should I use?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

9y ago

2 Answers

9

As long as you have the filename set as you mention, the command you want to use is
exiftool "-PNG:CreationTime<Filename" FileOrDir

Date Taken is a Windows property, not a metadata tag, and in the case of PNG files, it is set from the PNG:CreationTime tag. This is the only embedded metadata tag that Windows will read in a PNG file.

To set the Windows Date Take property in a PNG file to something else, you can use this command, replacing the time stamp appropriately:
exiftool -PNG:CreationTime="2017:01:10 10:45:01" FileOrDir

Edit: Just some notes on why your previous commands didn't work.
exiftool "-creationTime=-timecreated" * The equal sign assigns values. So in this case, you're assign the CreationTime tag the value of "-timecreated". If you wanted to copy the TimeCreated tag, you would have first had to drop the dash in front of -timecreated (only used at the very beginning to indicate a tag operation) and then used the tag copy operation (less/greater than symbol < or >) e.g. "-creationTime<timecreated" or "-TimeCreated>CreationTime". See Exiftool Common Mistake #5

exiftool "-creationTime<EXIF:DateCreated" * and exiftool.exe "-DateTimeOriginal>FileModifyDate" * At the original time posted, EXIF data in PNG files was non-standard, with ImageMagick, Exiv2, and exiftool using a work around to embed the data. An official location for EXIF data was added to the standard in 2017. These commands are properly formatted, but EXIF data in PNG files is rare unless specifically set by the user. There should have been a "No writable tags" error message. Note that while the second command works, most exiftool example show copying from the tag on the right into the tag on the left. The tag copy will follow the direction of the Less/Greater Than sign.

exiftool "-creationTime=now" * "Now" is an Exiftool pseudo-tag for the current date/time. But the equal sign is setting CreationTime to the value "now", not the DateTime of now. The proper command would have been "-CreationTime<Now" .

exiftool -v "-FileModifyDate>AllDates" * Properly formatted, but again it's a problem with PNGs lack of support for EXIF data at the time of the original post. AllDates is an Exiftool shortcut for three EXIF tags: EXIF:DateTimeOriginal, EXIF:ModifyDate, and EXIF:CreateDate.

Originally by user37960. Source · Licensed CC BY-SA 4.0

user37960

9y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

For PNG files, Windows "Date Taken" is not a standard EXIF field. In practice, Windows reads the PNG CreationTime tag for this.

Use ExifTool to write PNG:CreationTime from the filename:

exiftool "-PNG:CreationTime<Filename" FileOrDir

If you want to set it manually for a file, use a timestamp like:

exiftool -PNG:CreationTime="2017:01:10 10:45:01" FileOrDir

Why your earlier commands failed: = assigns a literal value, so -creationTime=-timecreated would write the text -timecreated, not copy another tag. Also, PNG doesn't use normal EXIF date fields the same way JPEGs do, so tags like DateTimeOriginal won't populate Windows' PNG "Date Taken" field.

If you specifically need broader EXIF-style date metadata, converting to JPEG was suggested in one answer, but for keeping PNGs and making Windows show "Date Taken," PNG:CreationTime is the relevant tag.

UniqueBot

AI

9y ago

Your Answer