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 170771 - [PATCH] change date when importing photos from a folder
[PATCH] change date when importing photos from a folder
Status: RESOLVED FIXED
Product: f-spot
Classification: Other
Component: General
0.0.x
Other Linux
: Normal enhancement
: ---
Assigned To: F-spot maintainers
F-spot maintainers
: 317838 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-03-18 08:58 UTC by Wouter
Modified: 2006-06-07 00:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (818 bytes, patch)
2005-08-07 15:19 UTC, Tommi Komulainen
none Details | Review
DateTimeOriginal, DateTime, and last File creation time (2.96 KB, patch)
2005-08-15 09:31 UTC, Bengt Thuree
none Details | Review
Patch (642 bytes, patch)
2005-08-19 13:59 UTC, Bengt Thuree
none Details | Review
test image for date bug. (120.37 KB, image/jpeg)
2005-10-19 03:25 UTC, Adam Williamson
  Details

Description Wouter 2005-03-18 08:58:08 UTC
Version details: .10
Distribution/Version: ubuntu hoary preview

It's a suggestion. When importing photos from a folder on the hard disk, the
date of the photo in F-Spot should be the creation date of the photo on the
disk, not the date of the import. The import from disk function will be much
more usefull in this way, imho.
Comment 1 Joshua Nichols 2005-03-27 01:09:11 UTC
Perhaps there should be an option on the Import Folder dialog to take the date
from the date of the import, the creation date, or possibly a user specified
date (for when the prior aren't accurate).

A related feature request would be to have the ability to manually specify the
photo date.
Comment 2 Alan Thompson 2005-03-29 03:19:42 UTC
Just to add a "me too".  I tried importing a directory structure that had been
copied from another machine.  There was no exif data in the files.  I was
chagrined that despite taking care to preserve the files' mtimes, f-spot wasn't
looking at those.  So yeah, that'd make a good option.
Comment 3 Gabriel Burt 2005-08-07 05:10:59 UTC
In response to comment #1 (editing date/time info by hand), please see bug 302567.
Comment 4 Tommi Komulainen 2005-08-07 15:19:50 UTC
Created attachment 50342 [details] [review]
proposed patch

Use Lookup instead of GetEntry and fall back to parent class implementation
(which will use file creation time) if the DateTimeOriginal tag does not exist.
Comment 5 Bengt Thuree 2005-08-15 09:31:53 UTC
Created attachment 50718 [details] [review]
DateTimeOriginal, DateTime, and last File creation time

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 6 Bengt Thuree 2005-08-19 13:59:21 UTC
Created attachment 50984 [details] [review]
Patch

New version of the patch.

The patch this time only checks the photo.Time for a valid time.
Patch for http://bugzilla.gnome.org/attachment.cgi?bugid=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 7 Gabriel Burt 2005-10-13 05:55:32 UTC
Stanislav Brabec posted some good ideas in duplicate bug #317838:

"For exifless images, f-spot currently sets the time to import time. This is not
very useful.

Possible solutions:
- Use image mtime. Trivial.
- Ask user. Trivial.
- Try to search "source" image. For example: pict3123_edited.jpg will search for
pict3123.*. Complicated and maybe also slow, but can help a lot for converted
RAW images without EXIF."
Comment 8 Gabriel Burt 2005-10-13 06:22:22 UTC
*** Bug 317838 has been marked as a duplicate of this bug. ***
Comment 9 Pat Suwalski 2005-10-17 04:32:49 UTC
Bengt's patch in Comment #6 fixes pretty much all of the import problems.
Comment 10 Pat Suwalski 2005-10-17 04:39:33 UTC
Correction to Comment #9: I was referring to Comment #5.
Comment 11 Adam Williamson 2005-10-18 23:17:46 UTC
Another vote for this bug. I have a bunch of old pictures taken with an old
digital camera which didn't write exif info. I know when they were taken and the
file date is correct (2002...), but when I import them, they all get the current
date, which mucks up my index. Merge the patch already :). thanks!
Comment 12 Adam Williamson 2005-10-19 03:24:22 UTC
Lewing suggested on IRC I should submit a test image, so I'm attaching one. File
date is 26th February 2002, which is the date I'd like f-spot to use. There's no
EXIF data in the image.
Comment 13 Adam Williamson 2005-10-19 03:25:18 UTC
Created attachment 53634 [details]
test image for date bug.
Comment 14 Larry Ewing 2005-11-14 21:21:33 UTC
A couple of notes on this.
 File.GetCreationTimeUtc
1) f-spot never used the import time but it used the incorrectly named
File.GetCreationTimeUtc which on unix returns the file ctime (aka _Change_ time)
which really has more to do with the directory than the file so this often ended
up being the import time.  CVS now uses the earlier of mtime and ctime when no
exif data is present.

2) When exif data is present is present CVS currently uses DateTimeOriginal and
if it can't find that, DateTime.  This will eventually need to be changed to
look through all the possible metdata sources.  Addtionally this problem applies
to more than just jpeg files and all the various file formats should be changed
to merge the metadata and make a best guess.

3) The patch no longer applies to the info box as that code has been rewritten.
 It might still make sense to use the photo.Time for the info box the current
code does not but it would be trivial to change.
Comment 15 Bengt Thuree 2005-11-16 06:28:31 UTC
Regarding the info box: I think we should check photo.Time, since this is where
all the information about the photo/image is stored. Easier to use one routine also.

Comment 16 Bengt Thuree 2006-02-17 12:02:18 UTC
I created bug #331503 with associated patch that should fix this problem.
Maybee not needed to create a new bug, but anyway.
#331503 is about keeping the Unix file stamp on the photo when you import it.
Comment 17 Bengt Thuree 2006-05-17 06:58:42 UTC
Perhaps we can close this one, and let bug #331503 handle it?
Since F-Spot will check the timestamp of the file it self as a last resort, and bug #331503 ensures that the timestamp is equal to the original file.
Comment 18 Larry Ewing 2006-06-07 00:46:17 UTC
yeah I'm closing this.