Call to advise on how to simplify copying metadata from one file to another


I use exiftool -TagsFromFile FILE_1[SOURCE] FILE_2[DESTINATION] quite often to copy all metadata from an original image to its version 2 or 3 or whatever new version I created in darktable. Usually I type exiftool -TagsFromFile in the terminal and then drag and drop files one by one there. I find this operation pretty time consuming and looking for a way to improve/automate it.
I was not able find a similar option in digikam. I can’t figure out a bash script either.
I am looking for ideas / tips. Any help would be greatly appreciated.

(Mica) #2

Are your file names predictable and repeatable? It is always img123.raw and img123.jpg?


It is usually from name.jpeg to name_001.jpeg / name_v2.jpeg
I can stick to a certain naming structure if needs be though.
What I know for sure is:Destinanation file is always newer than the source (file modify date)Destination file name is always longer than the source file name.

(Damon Lynch) #4

The Linux desktop really needs a tool that is independent of raw convertors and photo database management programs, just like Photo Mechanic does on Windows / Mac. Photo Mechanic efficiently handles your use case.

BTW it’s unlikely you want to copy all metadata. Probably in reality you want to copy only a sensible subset, because some metadata in the destination you really do not want to overwrite, such as color space .


Actually you are correct. Basically I want to copy everything I added in digiKam e.g. keywords, star ratings, GPS, comments, etc. But I bet exiftool or Exiv2 is capable of doing that. I just need to figure out a code that compares two input files e.g. $1 and $2 and takesone of them as source and the other one as destination.
I will post my progress here.

(darix) #6

doesnt darktable already copy in a lot of metadata?


It does but I think something was missing. I think face regions were

Best regards,


Looks like there is a possible bug in darktable. I noticed that if an image has a single face tag and face region it is gone after export from darktable. But if the is more than one the exported jpeg has them all.

Also (offtopic) sometimes image date of the new jpeg created by darktable is wrong. Deleting it and exporting again helps.

I will try to collect some logs for a good bug report

(Gys Van Zyl) #9

exiv2 has a standard command to copy exif data between matching filenames. From the manual:

exiv2 insert -l/tmp -S.CRW /data/*.JPG
      Copy  all  metadata  from CRW files in the /tmp directory to JPG
      files with corresponding basenames in the /data directory.  Note
      that  this  copies  metadata as is, without any modifications to
      adapt it to the requirements of the  target  format.  Some  tags
      copied like this may not make sense in the target image.