Bug 139361

Summary: Templates for meta data
Product: [Applications] digikam Reporter: Heiner Lamprecht <heiner>
Component: Metadata-TemplateAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: caulier.gilles, marcel.wiesweg, mikmach
Priority: NOR    
Version: 1.0.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 1.0.0
Sentry Crash Report:
Attachments: Template Metadata support to Caption and Tags side bar
Patch version 2
patch version 3
handle alternative language strings in Template
JPEG image created with BQM (converted from PNG, flipped, and Template applied)
digiKam sqlite database file compressed with bzip2
Template XML config file for digiKam
Copyrighted image to test template info import.

Description Heiner Lamprecht 2006-12-29 17:29:44 UTC
Version:           0.9.1-svn / 2006-12-29 (using KDE KDE 3.5.5)
Installed from:    SuSE RPMs
OS:                Linux

The idea is rather simple:  The user can select certain meta data fields, define their content (like "Copyright" -> "(c) 2006, Konqui", ...) and save those settings under a dedicated name.

In the context menu of the image and of the album, there should be a submenu "Apply metadata", listing all those templates.  By selecting a certain template, the configured meta data should be applied to all selected images, or all images in the album.

This would make meta data handling more easy, more efficient and more consistent.


Regards,


    Heiner
Comment 1 Mikolaj Machowski 2006-12-29 18:45:28 UTC
> The idea is rather simple:  The user can select certain meta data
> fields, define their content (like "Copyright" -> "(c) 2006, Konqui",
> ...) and save those settings under a dedicated name.

Copyright you can already set when importing images (I hope in future
this dialog will apply for all types of import), also in future you
should be able to mass edit of copyright fields.
Comment 2 Andi Clemens 2008-12-03 14:18:33 UTC
Still valid?
Comment 3 caulier.gilles 2008-12-03 14:36:18 UTC
Yes,

Heiner talk about to have collection of metadata template. For ex. diigiKam is used by more than one photograph and each guy assign dedicated copyright, and not only the same everywhere as it does currently.

Gilles Caulier
Comment 4 Andi Clemens 2008-12-03 14:57:54 UTC
Ah ok, now I get it...
Comment 5 Mikolaj Machowski 2008-12-03 22:05:34 UTC
Valid, valid. I will change status to reflect that.
Comment 6 caulier.gilles 2009-06-23 06:21:07 UTC
Heiner,

Targeted to 1.0. starting implementation. not yet completed.

Gilles Caulier
Comment 7 caulier.gilles 2009-06-23 14:40:35 UTC
SVN commit 985689 by cgilles:

Camera GUI : add option to apply metadata template to items to download from camera.
CCBUGS: 139361


 M  +14 -29    cameracontroller.cpp  
 M  +14 -30    cameraui.cpp  
 M  +3 -4      cameraui_p.h  
 M  +8 -11     downloadsettingscontainer.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=985689
Comment 8 caulier.gilles 2009-06-24 16:48:16 UTC
Created attachment 34786 [details]
Template Metadata support to Caption and Tags side bar

Marcel,

This patch touch Caption and Tags and MetadataHub. It's a big patch to add support of Template Metadata.

The goal is to apply a set of XMP value to files and DB, as it's done with Rating, Comments, etc.

This way is already implemented in CameraGUI.
This way is not yet implemented in Batch Queue Manager

A Template Metadata editor is already implemented in setup dialog. Look there :

http://farm4.static.flickr.com/3324/3656549471_5cbf1f86af_o.png

My patch do not work yet properlly. Template is not yet applied. It's certainly a little problem in MetadataHub Code.

Notes: 

- TemplateSelector widget give an user way to select right template to apply. "None" option want mean "don't apply Template to file".

- From SetupMetadata, "save default Photographer identity" and "save default credits and Copyright" are now obsolete (code not yet removed).
Comment 9 caulier.gilles 2009-06-24 18:45:30 UTC
Marcel,

A wrong signal have been used in TemplateSelector. now patch will work, in theory...

Gilles Caulier
Comment 10 caulier.gilles 2009-06-24 19:23:37 UTC
Marcel,

Sound like not all MetadataHub::write() methods are not patched...

Gilles
Comment 11 caulier.gilles 2009-06-24 20:32:50 UTC
Created attachment 34790 [details]
Patch version 2

Marcel,

New version of patch, with all MetadataHubb:write() methods implemented. Still doesn't work...

Gilles
Comment 12 caulier.gilles 2009-06-25 06:36:08 UTC
Created attachment 34797 [details]
patch version 3

writing template work now, but removing template not yet.
Comment 13 caulier.gilles 2009-06-25 12:23:23 UTC
SVN commit 986979 by cgilles:

added template management to Caption and tags right side bar.
CCBUGS: 139361


 M  +140 -66   digikam/metadatahub.cpp  
 M  +22 -19    digikam/metadatahub.h  
 M  +34 -8     libs/imageproperties/imagedescedittab.cpp  
 M  +2 -0      libs/imageproperties/imagedescedittab.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=986979
Comment 14 caulier.gilles 2009-06-25 13:45:16 UTC
SVN commit 987034 by cgilles:

add new settings to record template to image metadata.
remove obsolete methods from AlbumSettings.
CCBUGS: 139361


 M  +8 -90     digikam/albumsettings.cpp  
 M  +2 -20     digikam/albumsettings.h  
 M  +4 -2      digikam/metadatahub.cpp  
 M  +7 -6      digikam/metadatahub.h  
 M  +10 -21    utilities/setup/setupmetadata.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=987034
Comment 15 Marcel Wiesweg 2009-06-26 15:37:21 UTC
Two remarks: 

1) The word "template" is quite generic. What is meant is "templates to fill _Copyright_ fields". I would expect to see it labelled "Copyright:" in the right side bar.

2) Any newly imported image can contain an arbitrary new set of copyright values that are not yet set as a template. There may be need to edit these, in-place, or store them for future us as a template. Maybe, if the template doesn't match, instead of displaying "Dont change", show a summary like "Author Linus Th...", and when pressing the edit button, offer a dialog to edit properties, and, optionally, store them as a new permanent template.
Comment 16 caulier.gilles 2009-06-26 16:08:43 UTC
Created attachment 34831 [details]
handle alternative language strings in Template

Marcel, 

This patch will add Alternative Language (c) strings with Template.

ImageCopyright follow XMP with copyright and rightUsageTerms info and can store multiple language values. Template is patched for that and use KExiv2::AltLangMap container.

Template XML file structure is changed to

There is a problem in ImageCopyright class. look my TODO for details...

Gilles
Comment 17 caulier.gilles 2009-06-26 18:21:15 UTC
Marcel,

>1) The word "template" is quite generic. What is meant is "templates to fill
>_Copyright_ fields". I would expect to see it labelled "Copyright:" in the
>right side bar.

Agree about Template. But i think "Copyright" is not fine here, because informations are not only (C) relevant, as Instructions for example.

Any suggestions ? Mik, Andi ?

>2) Any newly imported image can contain an arbitrary new set of copyright
>values that are not yet set as a template. There may be need to edit these,
>in-place, or store them for future us as a template. Maybe, if the template
>doesn't match, instead of displaying "Dont change", show a summary like "Author
>Linus Th...", and when pressing the edit button, offer a dialog to edit
>>properties, and, optionally, store them as a new permanent template.

Agree. Import tool need to be added. Planed of course.

show a summary like "Author Linus Th..." is easy to do using tooltip over combobox. I will do it.

Gilles
Comment 18 Marcel Wiesweg 2009-06-26 19:51:03 UTC
SVN commit 987819 by mwiesweg:

Implement method to retrieve all entries of a property with language code.

CCBUG: 139361

 M  +19 -0     imagecopyright.cpp  
 M  +8 -0      imagecopyright.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=987819
Comment 19 Mikolaj Machowski 2009-06-26 21:04:37 UTC
"Rights management"?

When you changed terminology from copyright to more generous template I hoped for full metadata templates (dialogs exists in kipi-plugins) :)
Comment 20 caulier.gilles 2009-06-26 21:12:34 UTC
Marcel,

As you can see, Mik ask alreday to host more rights informations (:=)))...

Mik, 

I know, this dialog as author of plugin (:=))). But, i'm not sure if all XMP informations must be hosted there...

Gilles
Comment 21 caulier.gilles 2009-06-26 21:25:49 UTC
Mik,

"Rights management" is better, but a little bit long...

Gilles
Comment 22 Mikolaj Machowski 2009-06-27 00:35:04 UTC
@21 Could be shortened to "Rights mgmt". IMO shortcut popular enough for wide audience.

@20 "More is better" ;) Many metadata informations are repetitive; when importing set of photos, apart from caption 90% of informations will repeat.

For example when importing set of photos from holidays in Italy (various cities, using kipi-plugin dialog as an example):
1. Copyright info the same for all photos coming from the same photographer
2. "Origin" tab: country the same, province probably
3. Highly structured "Subjects" not really useful for personal photography of my example but when foto journalist is importing result of press conference (s)he would use "Subjects" and "Keywords" and for almost all photos from this event they will be the same.
4. Even recreational photography can use "Keywords" and in my example for all photos there would be common: Holidays, Italy, personal
5. Similar situation with "Categories"
6. "Status" and "Properties" are again more specialized and less useful in private photos but in professional work quick templates to describe most common scenarios are useful.
Comment 23 caulier.gilles 2009-06-27 11:50:18 UTC
SVN commit 988101 by cgilles:

Matadata Template : support of multi-language alternative contents.
CCBUGS: 139361


 M  +16 -2     digikam/metadatahub.cpp  
 M  +2 -2      libs/database/imagecopyright.cpp  
 M  +18 -18    libs/dmetadata/dmetadata.cpp  
 M  +19 -4     libs/dmetadata/template.cpp  
 M  +29 -17    libs/dmetadata/template.h  
 M  +1 -1      libs/template/templatelist.cpp  
 M  +134 -20   libs/template/templatemanager.cpp  
 M  +35 -38    utilities/setup/setuptemplate.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=988101
Comment 24 caulier.gilles 2009-06-27 12:02:05 UTC
patch applied.

Now, I would to optimize setup template dialog page layout. i don't like how it is. It's work, that all...

My idea is to use KTabWidget and group contents by categories. Suggestions welcome.

Gilles
Comment 25 caulier.gilles 2009-06-27 15:51:45 UTC
SVN commit 988170 by cgilles:

new Metadata Template Batch tool for Batch Queue Manager


 M  +44 -8     basetools/metadata/metadata.cpp
 M  +2 -0      basetools/metadata/metadata.h
 M  +1 -1      batchtoolsmanager.cpp
Comment 26 caulier.gilles 2009-06-27 16:01:39 UTC
Marcel,

Try with BQM and apply metadata template tool. 

Setup some images in BQM and run a template over. Create new file in a new dir to be clean

Go to album gui and look new files created. XMP are properlly adjusted, but DB do not reconized Template again. Look in the console :

 digikam(21668)/digikam (core) Digikam::MetadataHub::load: Found Metadata Template:  "_UNKNOW_TEMPLATE_" 

If you select one item from icon view, you will see that template is not recogized...

Note : don't forget to create new template since i have changed XML file structure to host template data.

Gilles
Comment 27 Mikolaj Machowski 2009-06-27 17:23:25 UTC
Everything here belongs to the same category. IMO no need for tabbed design. I would split it into two dialogs: one for templates management (New, Edit, Rename), second for editing of templates. In this scenario dialog for editing will be simpler because all management stuff will be somewhere else.
Comment 28 caulier.gilles 2009-06-29 08:58:24 UTC
Thanks Mik for your comment. I wil study this way when we will add more template entries in the future.

Another question: about Caption and Tags side bar, i'm not really satisfied with Template Selector widget, because it only give template title. The only way to see template contents is to open Template editor from setup dialog.

I think user must be able to see more Template details here. I think to add an horizontal tab in Caption and Tags and host Template selector at this place plus a template contents viewer below.

To resume : a tab to host all caption and tags settings without Template and a tab dedicated to set and view Template settings.

What do you think about ?

Gilles Caulier
Comment 29 Mikolaj Machowski 2009-06-29 10:52:05 UTC
With relatively simple metadata from current implementation it isn't necessary IMO. Descriptive title should be enough.

If you want something more elaborate maybe use popular now model of list (in KDE used eg. in list of Plasmoids and various implementations of Get Hot New Stuff): First line bolded with official title, second line smaller font with comment - this comment should be entered in separate field when creating template (like comments for albums.
Comment 30 caulier.gilles 2009-06-29 14:07:07 UTC
Mik,

Look my current implementation (not yet committed) :

http://farm3.static.flickr.com/2610/3671745610_27048484cb_o.png

Gilles Caulier
Comment 31 Mikolaj Machowski 2009-06-29 18:51:49 UTC
1. In components list on the left: Template -> Templates
2. I am not sure about fields titles. You are user friendly here but in long run it can cause problems IMO. XMP standards have several fields about authorship and even when some names aren't very intuitive it may be friendlier to use something which can be googled in standards than use more general terms which can lead to misunderstandings later. So: 
"Author Names" -> "Creator", 
"Authors position" -> "Creator's Jobtitle", 
"Credit" -> "Credit Line", 
"Copyright" -> "Copyright Notice",
"Right Usage Terms" -> "Rights Usage Terms" (just typo)

Official names taken from
IPTC Standard, Photo Metadata 2008, IPTC Core, Specification Version 1.1

http://www.iptc.org/std/photometadata/2008/specification/IPTC-PhotoMetadata-2008_2.pdf

I know some of them are longer and worse fit in right panel for example but I think clarity should beat convenience here.

3. Drop-down menus should be of equal width
Comment 32 caulier.gilles 2009-06-29 19:01:18 UTC
>1. In components list on the left: Template -> Templates

Done.

2. well IPTC and XMP sentences are very differents. I'm trying to use the most shorter version to optimize layout on GUI.

Also, i always take a look in Adobe/Apple programs, ACDSee, etc, to still the homogeneous with lead photo softwares.

In all case, use SHIFT+F1 and look complete descriptions of all entries. It's clear for end users.

>3. Drop-down menus should be of equal width

Just fixed by Andi in svn.

Gilles
Comment 33 Mikolaj Machowski 2009-06-29 20:21:11 UTC
@32

Let's compare
digiKam - Lightroom - Aperture - FotoStation - IPTC Paper
"Author Names" - Creator - Byline - Byline - "Creator"
"Authors position" - Job's Title - Byline title - Byline title - "Creator's Jobtitle"
"Credit" - Credit - Credit - Credit - "Credit Line" -> OK
"Copyright" - Copyright - Copyright Notice - Copyright String - "Copyright Notice" -> OK
Comment 34 caulier.gilles 2009-07-01 10:54:44 UTC
Marcel,

Using current code, if I make a new file with BQM applying template, when file is parsed to fill DB, template is not found. But, if i select this item to icon view and i run Read file metadata to DB from Caption and tags, Template is found and contents is displayed on Right tab.

Why template is not found when file is added to collection ?

Gilles
Comment 35 Marcel Wiesweg 2009-07-01 13:02:05 UTC
When using the right sidebar, DMetadata::getMetadataTemplate is used (*). This reads only one XMP value per property.
When a new file is scanned, ImageScanner will use DMetadata::getMetadataField.
This uses often more than one XMP field or IPTC field (takes the first one in which a value is found). The used fields are documented in DBSCHEMA.ods, tab "Metadata Mapping", and in the API docs of the ImageCopyright class.
DMetadata::setMetadataTemplate now seems to write to all relevant fields again.

I assume there is a bug or mismatch somewhere. Can you post or check the database copyright values for this file and the relevant metadata fields?

(*) I plan to unify the loading methods for "Read metadata to database", currently done with MetadataHub, and the ImageScanner code. There must be only one implementation.
Comment 36 caulier.gilles 2009-07-01 16:26:22 UTC
Marcel,

The image photo005.jpg created by BQM is registered in DB with ID 2542. There is no entry relevant in ImageCopyright table...

From the console :

digikam(23339)/digikam (core) Digikam::AlbumManager::slotDirWatchDirty: KDirWatch detected change at "/mnt/data/photos/test/batch queue tests"                                                                                                              
digikam(23339)/digikam (core) Digikam::DImg::load: "/mnt/data/photos/test/batch queue tests/photo005.jpg"  : JPEG file identified                                                                                                                           
digikam(23339)/digikam (core) Digikam::ImageScanner::addImage: Adding new item "/mnt/data/photos/test/batch queue tests/photo005.jpg"                                                                                                                       
digikam(23339) Digikam::ScanControllerLoadingCacheFileWatch::slotImageChanged: 2542 "/mnt/data/photos/test/batch queue tests/photo005.jpg"                                                                                                                  
digikam(23339)/KEXIV2 KExiv2Iface::KExiv2::getImageDateTime: DateTime => Exif.Photo.DateTimeOriginal =>  QDateTime("ven. sept. 29 18:38:11 2006")                                                                                                           
digikam(23339)/KEXIV2 KExiv2Iface::KExiv2::getDigitizationDateTime: DateTime (Exif digitalized):  ven. sept. 29 18:38:11 2006 
digikam(23339)/KEXIV2 KExiv2Iface::KExiv2::getImageOrientation: Orientation => Exif.Image.Orientation =>  1                   
digikam(23339) Digikam::ImageScanner::scanImageCopyright: (QVariant(QVariantMap, QMap(("x-default", QVariant(QString, "(C) digiKam Project - 2002-2009") ) )  ) ,  QVariant(QStringList, ("Andi Clement", "Gilles Caulier", "Marcel Wiesweg") ) ,  QVariant(QString, "digiKam Team") ,  QVariant(QVariantMap, QMap() ) ,  QVariant(QString, "www.digikam.org") ,  QVariant(QString, "digiKam staff") ,  QVariant(QString, "Published over the world as Open Source software") )                  

Gilles
Comment 37 caulier.gilles 2009-07-01 16:33:36 UTC
Created attachment 34973 [details]
JPEG image created with BQM (converted from PNG, flipped, and Template applied)
Comment 38 caulier.gilles 2009-07-01 16:36:15 UTC
Created attachment 34974 [details]
digiKam sqlite database file compressed with bzip2
Comment 39 caulier.gilles 2009-07-01 16:37:27 UTC
Created attachment 34975 [details]
Template XML config file for digiKam
Comment 40 Marcel Wiesweg 2009-07-01 19:23:44 UTC
SELECT * FROM ImageCopyright WHERE imageid=2542;
1389|2542|copyrightNotice|(C) digiKam Project - 2002-2009|x-default
1390|2542|creator|Andi Clement|
1391|2542|creator|Gilles Caulier|
1392|2542|creator|Marcel Wiesweg|
1395|2542|creatorJobTitle|digiKam staff|
1396|2542|instructions|Published over the world as Open Source software|
1393|2542|provider|digiKam Team|
1394|2542|source|www.digikam.org|

<authorsposition value="digiKam staff" /> -> OK
<credit value="digiKam Team" /> -> OK
<source value="www.digikam.org" /> -> OK
<instructions value="Published over the world as Open Source software" /> -> OK
<authors>
   <name value="Andi Clement" /> -> OK
   <name value="Gilles Caulier" /> -> OK
   <name value="Marcel Wiesweg" /> ->OK
</authors>
<copyright>
   <x-default value="(C) digiKam Project - 2002-2009" /> -> OK
</copyright>
<rightusageterms>
   <x-default value="GPL" /> -> FAIL
</rightusageterms>

Problem is right usage terms
Comment 41 Marcel Wiesweg 2009-07-01 20:15:15 UTC
Damn, this is a bug in libkexiv2.
I think this means we need a workaround in DMetadata?
Comment 42 Marcel Wiesweg 2009-07-01 20:16:27 UTC
SVN commit 990123 by mwiesweg:

TypeId of Xmp LangAltValue is Exiv2::langAlt, not Exiv2::xmpAlt

CCBUG: 139361


 M  +2 -1      kexiv2xmp.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=990123
Comment 43 caulier.gilles 2009-07-01 20:31:55 UTC
>Damn, this is a bug in libkexiv2.
>I think this means we need a workaround in DMetadata?

If fix don't change BC, no need. just backport your commit to KDE 4.2 branch...

I will do it...

Gilles
Comment 44 caulier.gilles 2009-07-01 20:36:02 UTC
SVN commit 990127 by cgilles:

libkexiv2 from KDE 4.2 branch : backport commit #990123 from trunk
CCBUGS: 139361


 M  +2 -1      kexiv2xmp.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=990127
Comment 45 caulier.gilles 2009-07-01 21:50:11 UTC
SVN commit 990139 by cgilles:

Pass unregistered template data to Caption and tags to be able to see template contents as well.
Still TODO : make a easy way to registered unknow template data in digiKam collection.
CCBUGS: 139361


 M  +4 -6      metadatahub.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=990139
Comment 46 caulier.gilles 2009-07-01 21:59:37 UTC
SVN commit 990143 by cgilles:

libkexiv2 from KDE 4.3 branch : backport commit #990123 from trunk
CCBUGS: 139361



 M  +2 -1      kexiv2xmp.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=990143
Comment 47 caulier.gilles 2009-07-02 08:43:47 UTC
Marcel,

It still a problem... sometime...

Typically, if an image has rights information in XMP which are not yet registered in digiKam Template collection, i must to see these informations in template viewer from Caption & Tags sidebar as "Don't Change"

The idea of course is to be able to register these information in a new template when you press template editor button on the right of template combobox.

In fact these information are not displayed. I trying to use Read Metadata from File to DB but no chance.

I will post a copyrighted photo to test... Let's me hear if you can reproduce the problem...

Gilles
Comment 48 caulier.gilles 2009-07-02 08:44:53 UTC
Created attachment 34990 [details]
Copyrighted image to test template info import.
Comment 49 caulier.gilles 2009-07-02 13:32:50 UTC
MArcel,

Forget my previous comments. it's work fine now. Sound like i link with and older libkexiv2.

I also tested on 2 others computers and all work fine.

All is implemented now. I close this file now.

Gilles