Summary: | digikam does not *add* EXIF:DateTimeOriginal when modifying date | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Jens <jens-bugs.kde.org> |
Component: | Metadata-Date | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | caulier.gilles |
Priority: | NOR | ||
Version: | 0.9.0 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 0.9.0 | |
Sentry Crash Report: | |||
Attachments: |
patch: change DateTimeOriginal, not -Digitized
patch that changes DateTimeDigitized only when importing images patch that changes DateTimeDigitized only when importing images |
Description
Jens
2006-05-24 21:36:28 UTC
Actually, it looks like Digikam wants to modifiy DateTimeDigitized in dmetadata.cpp: bool DMetadata::setImageDateTime(const QDateTime& dateTime) { // .... d->exifMetadata["Exif.Photo.DateTimeDigitized"] = exifdatetime; // .... Isn't this incorrect? Shouldn't the date that is presented to the user be the date the photo was taken, in general? (also in this file, further below, there is a setImageDimensions() function that outputs debug information about the file date/time, not the image dimensions. Might be misleading when searching for bugs later on ;) ) Thanks, Jens Jens, this is not a bug (:=))) I have volontary limited this implementation to fix DateTimeDigitized not DateTimeOriginal, to check/compare if really the date provided by camera is wrong. This is my idea : DateTimeOriginal is the date from camera DateTimeDigitized is the date fixed by digiKam Note that both tags are set to the same value by camera normally. The thread is open. If digiKam users want fix DateTimeOriginal at the same time by digiKam, there are just some line to add in DMetadata implementation Gilles Ah, but DateTimeDigitized is set by scanners as the time an (analog) picture was imported / scanned / digitized. So this might overwrite the date the picture was scanned. My camera only sets DateTimeOriginal, my scanner software only sets DateTimeDigitized. (but then again my camera is from 2002 ...) Jens Well Jens, you can make a little patch to fix it. It's a good exercice for you (:=))) Gilles Thanks, I'm on it. I also have the "small icons" (configurable) almost ready, I'll work on it over the weekend. I contacted Marcel about this too and he helped me get started. :-) Jens Is your "small icons" patch provide a simple option into setup General page ? Gilles No option yet, just a digikamrc value (IconSize). I don't know how to do GUI elements yet. But I'll learn :-) ok. I recommend you to make 2 patch : 1- to use a value from digikamrc file to set album icon size. 2- to make a simple size settings into Setup genral tab. This one can be not simple to do for you if you unknow the ALbumSettings class. Make the gui is easy with Qt/KDE. Get inspiration from setupgeneral implementation. Gilles Hi, I added my new patch to bug 102029 (where it belongs). Please see my comment there, and review. Jens Created attachment 16347 [details]
patch: change DateTimeOriginal, not -Digitized
Here is a patch so Digikam changes DateTimeOriginal.
SVN commit 546459 by cgilles: digikam from trunk : patch from Jens B.Benecke about to set Date & Time Original tags BUG: 127972 M +9 -3 dmetadata.cpp --- trunk/extragear/graphics/digikam/libs/dmetadata/dmetadata.cpp #546458:546459 @@ -738,19 +738,25 @@ { try { - kdDebug() << d->filePath << " ==> Date&Time: " << dateTime.toString(Qt::ISODate) << endl; + // In first we write date & time into Exif. - // In first we write date & time into Exif. - + // DateTimeDigitized is set by slide scanners etc. when a picture is digitized. + // DateTimeOriginal specifies the date/time when the picture was taken. + // For digital cameras, these dates should be both set, and identical. + // Reference: http://www.exif.org/Exif2-2.PDF, chapter 4.6.5, table 4, section F. + const std::string &exifdatetime(dateTime.toString(Qt::ISODate).ascii()); d->exifMetadata["Exif.Photo.DateTimeDigitized"] = exifdatetime; + d->exifMetadata["Exif.Photo.DateTimeOriginal"] = exifdatetime; // In Second we write date & time into Iptc. const std::string &iptcdate(dateTime.date().toString(Qt::ISODate).ascii()); d->iptcMetadata["Iptc.Application2.DigitizationDate"] = iptcdate; + d->iptcMetadata["Iptc.Application2.DateCreated"] = iptcdate; const std::string &iptctime(dateTime.time().toString(Qt::ISODate).ascii()); d->iptcMetadata["Iptc.Application2.DigitizationTime"] = iptctime; + d->iptcMetadata["Iptc.Application2.TimeCreated"] = iptctime; setImageProgramId(); return true; Hi Gilles, are you mad when I still complain? :-) IMHO, DateTimeDigitized should not be changed by Digikam, according to the EXIF spec. For digital cameras it does not matter, but for analog pictures that were scanned it does, since these specify two different values. I propose the following: If DateTimeOriginal and DateTimeDigitized are identical before Digikam changes them, update both. If they differ, only set DatetimeOriginal. This should be compatible with your idea in comment #2, but still retain the information when the pictures were scanned (as in my case). If you are OK with this, I will prepare another patch. Then, I will look at some other bug reports of Digikam to help you out. :-) Thanks :-) Jens You have right. I need a coffee (:=)))... This is my proposal : make a boolean operator in this method to set both or just one DateTime tags. Only the context will chose what we need to fix in Exif metadata. This is want mean that you need to search in digiKam where this method is used. A grep is enough to find it. Normally is set during Camera download and when you use "Comment&Tags" sidebar tab. - During Camera download both value need to be changed, because some cameras (like my Olympus C3000Z) set these values to 0! - In Comment&Tags, only the DateTimeOriginal must be fixed. Are you agree ? Gilles Created attachment 16365 [details]
patch that changes DateTimeDigitized only when importing images
Hi,
here is a patch that does that (I hope =) ).
Jens
Created attachment 16367 [details]
patch that changes DateTimeDigitized only when importing images
I need to learn to patch properly. There was a change missing ... although not
fatal because I used a default parameter.
Here is the correct patch.
Jens
SVN commit 546750 by cgilles: digikam from trunk: patch from Jens B.Benecke about to fix Exif date and Time tags rules depending of context. CCBUGS: 127972 M +9 -5 libs/dmetadata/dmetadata.cpp M +1 -1 libs/dmetadata/dmetadata.h M +1 -1 libs/imageproperties/imagedescedittab.cpp M +1 -1 utilities/cameragui/cameracontroller.cpp M +6 -5 utilities/cameragui/cameraui.cpp --- trunk/extragear/graphics/digikam/libs/dmetadata/dmetadata.cpp #546749:546750 @@ -734,7 +734,7 @@ return QDateTime(); } -bool DMetadata::setImageDateTime(const QDateTime& dateTime) +bool DMetadata::setImageDateTime(const QDateTime& dateTime, bool setDateTimeDigitized) { try { @@ -746,17 +746,21 @@ // Reference: http://www.exif.org/Exif2-2.PDF, chapter 4.6.5, table 4, section F. const std::string &exifdatetime(dateTime.toString(Qt::ISODate).ascii()); - d->exifMetadata["Exif.Photo.DateTimeDigitized"] = exifdatetime; d->exifMetadata["Exif.Photo.DateTimeOriginal"] = exifdatetime; + if(setDateTimeDigitized) + d->exifMetadata["Exif.Photo.DateTimeDigitized"] = exifdatetime; // In Second we write date & time into Iptc. const std::string &iptcdate(dateTime.date().toString(Qt::ISODate).ascii()); - d->iptcMetadata["Iptc.Application2.DigitizationDate"] = iptcdate; - d->iptcMetadata["Iptc.Application2.DateCreated"] = iptcdate; const std::string &iptctime(dateTime.time().toString(Qt::ISODate).ascii()); - d->iptcMetadata["Iptc.Application2.DigitizationTime"] = iptctime; + d->iptcMetadata["Iptc.Application2.DateCreated"] = iptcdate; d->iptcMetadata["Iptc.Application2.TimeCreated"] = iptctime; + if(setDateTimeDigitized) + { + d->iptcMetadata["Iptc.Application2.DigitizationDate"] = iptcdate; + d->iptcMetadata["Iptc.Application2.DigitizationTime"] = iptctime; + } setImageProgramId(); return true; --- trunk/extragear/graphics/digikam/libs/dmetadata/dmetadata.h #546749:546750 @@ -101,7 +101,7 @@ bool setExifThumbnail(const QImage& thumb); bool setImageDimensions(const QSize& size); bool setImageOrientation(ImageOrientation orientation); - bool setImageDateTime(const QDateTime& dateTime); + bool setImageDateTime(const QDateTime& dateTime, bool setDateTimeDigitized = false); bool setImageComment(const QString& comment); bool setImageRating(int rating); bool setImageKeywords(const QStringList& oldKeywords, const QStringList& newKeywords); --- trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.cpp #546749:546750 @@ -410,7 +410,7 @@ if (AlbumSettings::instance()->getSaveDateTime()) { // Store Image Date & Time as Exif and Iptc tags. - metadata.setImageDateTime(d->dateTimeEdit->dateTime()); + metadata.setImageDateTime(d->dateTimeEdit->dateTime(), false); } if (AlbumSettings::instance()->getSaveIptcRating()) --- trunk/extragear/graphics/digikam/utilities/cameragui/cameracontroller.cpp #546749:546750 @@ -354,7 +354,7 @@ DMetadata metadata(tempURL.path()); if (fixDateTime) - metadata.setImageDateTime(newDateTime); + metadata.setImageDateTime(newDateTime, true); if (setPhotographerId) metadata.setImagePhotographerId(author, authorTitle); --- trunk/extragear/graphics/digikam/utilities/cameragui/cameraui.cpp #546749:546750 @@ -202,11 +202,11 @@ d->autoRotateCheck = new QCheckBox(i18n("Rotate/flip image"), exifBox); d->autoAlbumCheck = new QCheckBox(i18n("Date-based sub-albums"), exifBox); QWhatsThis::add( d->autoRotateCheck, i18n("<p>Toogle on this option if you want automatically " - "rotated or fliped images using EXIF informations " - "provided by camera")); + "rotated or flipped images using EXIF information " + "provided by camera.")); QWhatsThis::add( d->autoAlbumCheck, i18n("<p>Toogle on this option if you want downloaded photos " "into automatically created date-based sub-albums " - "of destination album")); + "of destination album.")); QVGroupBox* OnFlyBox = new QVGroupBox(i18n("On the Fly Operations"), d->advBox); d->setPhotographerId = new QCheckBox(i18n("Set default photographer identity"), OnFlyBox); @@ -216,11 +216,12 @@ QWhatsThis::add( d->setPhotographerId, i18n("<p>Toogle on this option to store default photographer identity " "into IPTC tags using main digiKam metadata settings.")); - QWhatsThis::add( d->setCredits, i18n("<p>Toogle on this option to store default credit and copyrigth informations " + QWhatsThis::add( d->setCredits, i18n("<p>Toogle on this option to store default credit and copyright information " "into IPTC tags using main digiKam metadata settings.")); QWhatsThis::add( d->fixDateTimeCheck, i18n("<p>Toogle on this option to set date and time metadata " "tags to the right values if your camera don't set " - "properlly these tags when pictures are taken.")); + "properly these tags when pictures are taken. The values will" + "be saved in the DateTimeDigitized and DateTimeCreated EXIF/IPTC fields.")); grid->addMultiCellWidget(d->renameCustomizer, 0, 0, 0, 1); grid->addMultiCellWidget(exifBox, 1, 1, 0, 1); |