Get Last Modified Date of A Raster Image
Get Last Modified Date
Aspose.Imaging for Java has exposed the getModifyDate method of Image class to get the last modified date of an image from its metadata. getModifyDate method needs a Boolean value to get the modified date accordingly.
The steps to get last modified date are as simple as below:
- Load an image using the factory method Load exposed by Image class.
- Convert the image into RasterImage.
- Call the RasterImage.getModifyDate method by passing a Boolean true or false value.
The following code example demonstrates how to get last modified date of the image.
// For complete examples and data files, please go to https://github.com/Muhammad-Adnan-Ahmad/Aspose.Imaging-for-Java | |
String path = dataDir + "aspose-logo.jpg"; | |
com.aspose.imaging.RasterImage image = (com.aspose.imaging.RasterImage) Image.load(path); | |
try { | |
// gets the date from [FileInfo] | |
String modifyDate = image.getModifyDate(true).toString(); | |
System.out.format("Last modify date using FileInfo: %s\n", modifyDate); | |
// gets the date from XMP metadata of [FileInfo] as long as it's not | |
// default case | |
modifyDate = image.getModifyDate(false).toString(); | |
System.out.format("Last modify date using info from FileInfo and XMP metadata: %s\n", modifyDate); | |
} finally { | |
image.dispose(); | |
} |