After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 309436 - DateTimeOriginal in EXIF does not exist but DateTime does
DateTimeOriginal in EXIF does not exist but DateTime does
Status: RESOLVED FIXED
Product: f-spot
Classification: Other
Component: General
0.0.x
Other All
: Normal normal
: ---
Assigned To: F-spot maintainers
F-spot maintainers
Depends on:
Blocks:
 
 
Reported: 2005-07-04 11:47 UTC by Christian Pearce
Modified: 2006-02-17 19:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Looking at EXIF tags (412.95 KB, image/png)
2005-07-04 11:53 UTC, Christian Pearce
  Details
If DateTimeOriginal do not exist, use DateTime (and last file creation time) (2.96 KB, patch)
2005-08-15 09:33 UTC, Bengt Thuree
none Details | Review
patch (642 bytes, patch)
2005-08-19 14:04 UTC, Bengt Thuree
none Details | Review

Description Christian Pearce 2005-07-04 11:47:13 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:
Comment 1 Christian Pearce 2005-07-04 11:53:59 UTC
Created attachment 48621 [details]
Looking at EXIF tags
Comment 2 Bengt Thuree 2005-08-15 09:33:14 UTC
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
Comment 3 Bengt Thuree 2005-08-19 14:04:34 UTC
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.
Comment 4 Bengt Thuree 2006-02-17 03:39:45 UTC
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

Comment 5 Larry Ewing 2006-02-17 19:04:52 UTC
Yeah this is fixed.