drewnoakes / metadata-extractor

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Apache License 2.0
2.59k stars 484 forks source link

Retrieving Exif IFD0:Date/Time in (possibly) the wrong format. #686

Open mbmast opened 6 days ago

mbmast commented 6 days ago

Possible issue, not really certain.

Using metadata-extractor-2.19.0.jar against the attached file, I get the following metadata tag Exif IFD0:Date/Time value: Sat Feb 04 18:44:14 2006. Isn't this formatted incorrectly for this tag? Shouldn't it be formatted like this: YYYY:MM:DD HH:MM:SS?

fd70467fa959724e3570d3f9ee513a9d84a097fe

drewnoakes commented 4 days ago

Can you share your code? It's possible that the date is being parsed and reformatted on your machine to a local culture's date format.

DAN-MU-ZI commented 4 days ago

@mbmast @drewnoakes This issue arises because the DateTime field in the Exif metadata is stored in RFC 2822 format as ASCII values, rather than following the Exif DateTime format ("YYYY:MM:DD HH:MM:SS"). The current implementation does not handle this discrepancy and simply outputs the stored value. To address this, it seems necessary to implement additional processing, such as delegating the responsibility of handling this field to ExifIFD0Descriptor, to ensure proper formatting or error handling in compliance with Exif standards.

For reference, the Exif standard specifies the required DateTime format on page 44 of the official document: Exif Standard (CIPA DC-008-2012).

drewnoakes commented 3 days ago

image

Sat Feb 04 18:44:14 2006 is the value stored in the image. As @DAN-MU-ZI says, this is not the expected format. You can try and parse it yourself if you like.

The library does go to some effort to try and parse the date when it can, but it doesn't support this format. See:

https://github.com/drewnoakes/metadata-extractor/blob/0c3452bf1c4556724930281ffd97f65b66bfd697/Source/com/drew/metadata/Directory.java#L879-L894

Sharing your code would be helpful.

mbmast commented 2 days ago

I’ll post some code after the Thanksgiving holiday. On Nov 26, 2024, at 03:18, Drew Noakes @.***> wrote: image.png (view on web) Sat Feb 04 18:44:14 2006 is the value stored in the image. As @DAN-MU-ZI says, this is not the expected format. You can try and parse it yourself if you like. The library does go to some effort to try and parse the date when it can, but it doesn't support this format. See: https://github.com/drewnoakes/metadata-extractor/blob/0c3452bf1c4556724930281ffd97f65b66bfd697/Source/com/drew/metadata/Directory.java#L879-L894 Sharing your code would be helpful.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>