Home > Blockchain >  Getting CreationTime from PNG
Getting CreationTime from PNG

Time:05-30

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?

CodePudding user response:

Would File.GetCreationTime(file path) from the System.IO namespace fit your needs? This will give you the recorded creation date of any file. For information on how to fit this into what you're using refer to:

https://docs.microsoft.com/en-us/dotnet/api/system.io.file.getcreationtime?view=net-6.0

  • Related