]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/jpeg/ExternalExifLibrary.java
Version 11, August 2010
[GpsPrune.git] / tim / prune / jpeg / ExternalExifLibrary.java
index b9cd1fdadf33bb739868d98c716c8d8b4d44fc16..1c64b4e247fcd83ba4632050667a61fe09c1c5c3 100644 (file)
@@ -66,7 +66,9 @@ public class ExternalExifLibrary implements ExifLibrary
                                        data.setGpsTimestamp(new int[] {times[0].intValue(), times[1].intValue(),
                                                times[2].intValue()});
                                        Rational[] dates = gpsdir.getRationalArray(TAG_GPS_DATESTAMP);
-                                       data.setGpsDatestamp(new int[] {dates[0].intValue(), dates[1].intValue(), dates[2].intValue()});
+                                       if (dates != null) {
+                                               data.setGpsDatestamp(new int[] {dates[0].intValue(), dates[1].intValue(), dates[2].intValue()});
+                                       }
                                }
                        }
 
@@ -75,10 +77,14 @@ public class ExternalExifLibrary implements ExifLibrary
                        {
                                Directory exifdir = metadata.getDirectory(ExifDirectory.class);
 
-                               // Take time and date from exif tags if haven't got it already from GPS
-                               if (data.getGpsDatestamp() == null && exifdir.containsTag(ExifDirectory.TAG_DATETIME_ORIGINAL)) {
+                               // Take time and date from exif tags
+                               if (exifdir.containsTag(ExifDirectory.TAG_DATETIME_ORIGINAL)) {
                                        data.setOriginalTimestamp(exifdir.getString(ExifDirectory.TAG_DATETIME_ORIGINAL));
                                }
+                               // Also take "digitized" timestamp
+                               if (exifdir.containsTag(ExifDirectory.TAG_DATETIME_DIGITIZED)) {
+                                       data.setDigitizedTimestamp(exifdir.getString(ExifDirectory.TAG_DATETIME_DIGITIZED));
+                               }
 
                                // Photo rotation code
                                if (exifdir.containsTag(ExifDirectory.TAG_ORIENTATION)) {