[Digikam-devel] [Bug 215990] Tagging files on external media using stored metadata and thumbnails

docali at trash-mail.com docali at trash-mail.com
Sun Dec 27 16:44:16 GMT 2009


https://bugs.kde.org/show_bug.cgi?id=215990





--- Comment #1 from  <docali trash-mail com>  2009-12-27 17:43:19 ---
As a temporary workaround I made 2 Bash scripts

The first one extracts the Thumbnail from the NEF Raw file, adds _Preview,
stores it in a folder with the suffix _preview.

This folder is then copied to my local disk and edited with digikam

Afterwards it tags be synced by Copying the XMP:TagsList back to the original
NEF file. But at the moment exiftool doesn't support writing the
XMP-digikam:TagsList Tag.

Here are my two script: 
#!/bin/bash
if [ $# -ne 1 ]  # Must have command-line args to use script.
then
  echo
   echo
  echo "usage: ${Scriptname} OriginalFolder"
  exit 
fi  

cd $1
TEMP=$1            #Produce PreviewFolder
TEMP2=$(basename $PWD)
DIR="${TEMP}${TEMP2}_Preview"
echo $DIR
mkdir $DIR
echo Extract Preview
echo ==============================
exiftool -b -PreviewImage -w ${DIR}/%f_Preview.JPG -ext NEF -r .
echo
echo
echo Copy original Tags
cd $DIR
exiftool -v0  -tagsfromfile ../%-.8f.NEF -r -ext JPG -overwrite_original
--PreviewImage --ThumbnailImage .
echo
echo
echo Rotate
echo =====================
for i in *.JPG; do exiftran -a -g -i $i;done;


The second one to sync back

#!/bin/bash

PreviewDir=$1 
BasenamePreviewDir=${PreviewDir%/}  #Cut trailing /
BasenamePreviewDir=${BasenamePreviewDir##*/} #Cut all till last / 

OriginalDir=$2
BasenameOriginalDir=${OriginalDir%/}  #Cut trailing /
BasenameOriginalDir=${BasenameOriginalDir##*/} #Cut all till last / 
Scriptname=${0##*/}
Scriptname=${Scriptname%%.sh}

if [ $# -ne 2 ]  # Must have command-line args to use script.
then
  echo
  echo "Resync XMP and GPSTags to original NEF Files"
  echo
  echo "usage: ${Scriptname} PreviewOrdner OriginalOrdner"
  exit 
fi  

if [ ! ${BasenamePreviewDir##*_} = "Preview" ]
then
  echo "The first cmdline prm must be the Preview folder"
  exit
fi

if [ ! ${BasenamePreviewDir%%_Preview} = $BasenameOriginalDir ]
then
  echo "Preview Folder and Original Folder don't fit!"
  exit
fi

cd $2
echo $PWD
read -p "Press Key to start copying"
exiftool -v  -tagsfromfile ${1}%f_Preview.JPG "-XMP-digikam:TagsList"
"-XMP:Subject" "-GPS:all"  -r -ext NEF -overwrite_original .

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Digikam-devel mailing list