GNOME Bugzilla – Bug 309436
DateTimeOriginal in EXIF does not exist but DateTime does
Last modified: 2006-02-17 19:04:52 UTC
Please describe the problem: I imported a bunch of photos that have the correct time and date, but they are not read by f-sport. I look at the code ExifUtil.cs doesn't actually look at DateTime. info.DateTime = exif_data.LookupFirstValue (Exif.Tag.DateTimeOriginal); I am hacking at the code right now for a quick fix. I am attaching a screen shot so you can see what is up. I am also working creating a quick perl scrip that will update the sqlite database with the correct values. Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information:
Created attachment 48621 [details] Looking at EXIF tags
Created attachment 50719 [details] [review] If DateTimeOriginal do not exist, use DateTime (and last file creation time) THIS PATCH IS THE SAME AS THE ONE I SUBMITTED FOR 170771 Hej I created a small patch on F-Spot-0.0.13 for Bug 170771 and 309436. In essence what I did was as follows: 1) ExifUtils.cs // Check first for DateTimeOriginal, then for DateTime, // and last for File Creation time of the photo. info.DateTime = exif_data.LookupFirstValue (Exif.Tag.DateTimeOriginal); if (info.DateTime == null || info.DateTime == "") info.DateTime = exif_data.LookupFirstValue (Exif.Tag.DateTime); if (info.DateTime == null || info.DateTime == "") { DateTime slask = File.GetCreationTimeUtc (path); info.DateTime = slask.ToString ("yyyy:MM:dd hh:mm:ss"); } 2) InfoBox.cs if (photo.Time > DateTime.MinValue && photo.Time < DateTime.MaxValue) Modified InfoBox.cs to instead of checking exposure_info.DateTime, we check photo.Time. (Do not know why we check exposure_info...) 3) JpegFile.cs string time_str = ""; // Check first for DateTimeOriginal, then for DateTime, // and last for File Creation time of the photo. time_str = ed.LookupFirstValue (Exif.Tag.DateTimeOriginal); if (time_str == null || time_str == "") time_str = ed.LookupFirstValue (Exif.Tag.DateTime); if (time_str == null || time_str == "") { DateTime slask = File.GetCreationTimeUtc (path); time_str = slask.ToString ("yyyy:MM:dd hh:mm:ss"); } Instead of the original routine (below) //Exif.ExifContent content = ed.GetContents (Exif.Ifd.Exif); // Exif.ExifEntry entry = content.GetEntry (Exif.Tag.DateTimeOriginal); // time = Exif.ExifUtil.DateTimeFromString (entry.Value); which always returned Now() if no Exif tags were available, I used the same routine as in ExifUtils.cs which works fine. Now we check in order for 1) DateTimeOriginal 2) DateTime 3) file creation date I did not add a possibility to set a date/time manually when you add pictures. The command I used to create the diff files were as follows diff -Naur ../f-spot-0.0.13.orig/src/ src/ > patch.diff This patch will fix the problem with 170771 (no Exif data in files), as well as 309436 (EXIF value for DateTimeOriginal do not exist, but DateTime do) /Bengt
Created attachment 50985 [details] [review] patch This patch is identical to bug http://bugzilla.gnome.org/attachment.cgi?bugid=170771 New version of the patch. The patch this time only checks the photo.Time for a valid time. Patch for 302567 will set the photo.Time to DateTimeOriginal, DateTimeDigitized, DateTime, or File Creation time, as well as update the picture's DateTimeOriginal EXIF tag if needed.
Isn't this fixed in CVS now? JpegFile.cs has the following code: - time_str = ed.LookupFirstValue (Exif.Tag.DateTimeOriginal); - if (time_str == null || time_str == "") - time_str = ed.LookupFirstValue (Exif.Tag.DateTime); It do not check for DateTimeDigitized, but perhaps not needed at this stage
Yeah this is fixed.