Carrying Photo Metadata from Darktable to Piwigo
Darktable exports photo fields to metadata as follows (as reported by exiv2 pr -pa {file}.jpg
):
Darktable title -> Xmp.dc.title
Darktable description -> Xmp.dc.description
Darktable tagging section -> Xmp.dc:subject (as a comma-separated list)
Unfortunately, Piwigo does not read XMP metadata so only the description is available as Exif.Image.ImageDescription
. IPTC is required for the title and tags. Darktable does not export IPTC, but can be scripted to copy XMP tags to IPTC. See instructions here: https://discuss.pixls.us/t/name-description-and-keywords-are-not-recognized-by-shutterstock/6726/26
and source code here: https://github.com/chrik5/lua-scripts/blob/exiftool/contrib/exiftool_export.lua
In Darktable, using exiftool on export from above, check enable exiftool, set options to -@ and create file xmp2iptc.txt
with the following contents:
-XMP-dc:Subject > IPTC:Keywords
-XMP-dc:Description > IPTC:Caption-Abstract
# -XMP-dc:Title > IPTC:ObjectName
(uncomment out the last line if you want to use the Title in Darktable rather than the filename Piwigo uses by default; and update use_iptc_mapping
array below)
Set this file as Argumentsfile.
Then export the files from Darktable.
Using Piwigo plugin LocalFiles Editor add these lines to local config file local/config/config.inc.php
:
// use_iptc: Use IPTC data during database synchronization with files
// metadata
$conf['use_iptc'] = true;
// use_iptc_mapping : in which IPTC fields will Piwigo find image // information? This setting is used during metadata synchronisation. It // associates a piwigo_images column name to a IPTC key // See https://exiftool.org/TagNames/IPTC.html // and http://piwigo.org/doc/doku.php?id=user_documentation:metadata&s $conf['use_iptc_mapping'] = array( 'keywords' => '2#025', 'comment' => '2#120' );
From this point on, you’ll only have to remember to activate exiftool on export in Darktable and Piwigo will do the rest.