How to get date picture created in java

后端 未结 5 2428
青春惊慌失措
青春惊慌失措 2021-02-20 16:26

I would like to extract the date a jpg file was created. Java has the lastModified method for the File object, but appears to provide no support for extracting the created date

5条回答
  •  别那么骄傲
    2021-02-20 17:15

    I use this metadata library: http://www.drewnoakes.com/code/exif/

    Seems to work pretty well, although bear in mind that not all JPEG images have this information, so it can't be 100% fool-proof.

    If the EXIF metadata doesn't contain the created date, then you'll probably have to make do with Java's lastUpdated - unless you want to resort to Runtime.exec(...) and using system functions to find out (I wouldn't recommend this, though!)

提交回复
热议问题