I want to find the "Date Taken" of an image and not "date modified" or "date created". Though I have found some links on stackoverflow, but none could retrieve it. The image format is: tiff and RAW.
Using javax.imageio
, I wrote the below program, but it prints nothing. Which means there is no reader
available
File file = new File( fileName );
ImageInputStream iis = ImageIO.createImageInputStream(file);
Iterator<ImageReader> readers = ImageIO.getImageReaders(iis);
if (readers.hasNext()) {
// pick the first available ImageReader
ImageReader reader = readers.next();
// attach source to the reader
reader.setInput(iis, true);
// read metadata of first image
IIOMetadata metadata = reader.getImageMetadata(0);
String[] names = metadata.getMetadataFormatNames();
int length = names.length;
for (int i = 0; i < length; i++) {
System.out.println( "Format name: " + names[ i ] );
displayMetadata(metadata.getAsTree(names[i]));
}
}
Using the core java libraries, is there a method to access "date taken" and not "date created" or "date modified".
Further the data taken
info is available as I can see that from image properties in OS
EDIT: It turns out that readers
iterator has nothing with it. i.e.e size 0. It is only happening for tiff and raw images. Works well with jpeg
Date Stamp Removal Using The Crop Tool Cropping is the easiest and fastest way to get rid of unwanted objects in photos. You don't even need Photoshop for this, as most standard photo editing tools in your phone or computer will come with a cropping option.
I could not find any solution using java core libraries. Found a library called metadata-extractor which does the job.
More info can be found here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With