I'm coding a winForm application that renames images with the datetime taken. e.g. Original image name => Image_YYYYMMDD_HHMMSS
I was using GetPropertyItem(36867) which is the Exif Date/Time Origin. But this only works on JPG, not PNG. As far as I know PNG does not have exif until recent versions and the closest thing in PNG is CreationTime. Also, I've come across a discussion thread about calling exiftool in console.
Is it possible to get the date/time without exiftool? Or how can I implement exiftool into my c# GUI program without adding too much complexity?
File.GetCreationTime(file path)
from the System.IO
namespace is the best you can (reliably) do. Unfortunately PNG metadata doesn't usually contian a creation date so getting the write date is the best you can do. For more information on how to use this, read:
https://learn.microsoft.com/en-us/dotnet/api/system.io.file.getcreationtime?view=net-6.0