3

I've been using Rawtherapee for post processing for a short while, and, even though I've been able to adapt well my workflow to it, I've found that having to look through most of the photos I took just to rate them (So I can later filter them) is a quite cumbersome process.

I've been looking to include Digikam in my workflow mostly for organizational purposes, and I've found that opening and rating the shots is an easier and quick task with this tool than with Rawtherapee.

So, right now, my idea of workflow should be:

1) Download images from camera (d'uh)

2) Open them on Digikam. Delete bad shots, rate the rest of the shots.

3) Open the folder on Rawtherappe, make the program read the Digikam ratings and filter photos.

I've been doing a bit of research and found that this is handled through "sidecar" files, but it looks like Digicam creates XMP files (If asked to create a separate sidecar file, of course) and Rawtherapee goes for the pp3 extension.

And now I'm stuck. There's any easy way to convert from one to the other, maybe I can configure either rawtherapee or digikam to read/write the other program sidecar files? Should I take a different approach (Namely, just moving the discarded photos to a /EventFolder/Discards manually or through a script)?

Thanks!

4

As far as I know, there is currently no way to translate PP3 to XMP sidecars, or vice versa.
And developers are often reluctant to adapt their program to read data written by another program, especially for formats like .PP3, which can change without warning between program versions*.

Even exchanging XMP files from different programs isn't all that evident. As an example: Digikam and Darktable (another raw editor) both use XMP sidecars. While things like ratings, tags, captions and title are well transmitted, each has some individual quirks that the other won't pick up.
Of course, each ignores processing instructions from the other, as the underlying algorithms can be different between the programs*.
And Digikam+Darktable is a fairly common combination, judging from mailing list traffic.

*: Trying to do otherwise would make a program dependent on the program it's trying to interact with, possibly breaking the workflow of the users regularly. Not nice for the users, and the resulting complaints aren't nice for the developers, who usually are short on time (small teams, often unpaid...).

  • Well, bummer. It seems I will go to the "create discard folder" route, then. Thanks! – Neuromante May 18 '18 at 15:43
0

There are several XMP tags that DigiKam writes for ratings, but the most important one will be:

xmp:Rating="0"   // values 0 (none) to 5
digiKam:ColorLabel="0"  // values 0 (none) to 9.
// xmp:Label is used only if it is a Lightroom-compatible color

RawTherapee uses:

[General]
Rank=0         // values 0 (none) to 5
ColorLabel=0   // RawTherapee uses only 5 colors (0-5)

If you feel brave enough, you can use regex to transfer the information from PP3 to XMP or vice versa.

Steps:

  1. Download images from camera (d'uh).
  2. Open them on Digikam. Delete bad shots, rate the rest of the shots (make sure that XMPs are written).
  3. Open RawTherapee and open the files' folder. This should write the .pp3 files for all images. Close RT / go to a different folder.
  4. Regex it - We will dive into that in a moment!
  5. Open the folder again with RT. Enjoy how easily text files are manipulated.

I created a Python (version 3) script that does the regex-operation for all PP3s and XMPs in a folder.

NB: This code might damage your sidecar files. It might not work with other versions than DigiKam's 6.3.0 and RawTherapee's 5.7. Make a backup first, then try this!

Walkthrough for above-mentioned 4.:

  • Make sure DigiKam has set a color tag: if you do not have any set, apply one, save metadata, delete the color, save metadata again.
  • Install Python,
  • Open a console, cd to the folder with the images,
  • python <path to your python script>, where your script is:
import re
from pathlib import Path

# Find only *.pp3 and *.xmp in this folder, keep only those that have a twin with the other extension:
found_pp3 = [str(x.resolve()) for x in Path("./").glob('*.pp3') if
             Path(re.sub('\.pp3$', '.xmp', str(x.resolve()), flags=re.MULTILINE)).is_file()]
found_xmp = [str(x.resolve()) for x in Path("./").glob('*.xmp') if
             Path(re.sub('\.xmp$', '.pp3', str(x.resolve()), flags=re.MULTILINE)).is_file()]       
print(str(len(found_pp3)) + " | " + str(len(found_xmp)) + " files found.")

# Making sure that A.pp3 is used as the same time as A.xmp:
found_pp3 = sorted(found_pp3, key=str.lower)
found_xmp = sorted(found_xmp, key=str.lower)

# Having fun with regex:
i = 0
while i < len(found_pp3):
    print(found_xmp[i] + " --> " + found_pp3[i])
    # Copying content of 1st/2nd/... file into variable:
    temp_xmp = Path(found_xmp[i]).read_text(encoding='utf-8')
    temp_pp3 = Path(found_pp3[i]).read_text(encoding='utf-8')
    # Substituting Stars (aka rank/rating) from xmp to pp3:
    temp_xmp_rating = re.search('xmp:Rating=\"(.+?)\"', temp_xmp).group(1)
    temp_pp3 = re.sub('Rank=\d', 'Rank=' + temp_xmp_rating, temp_pp3)
    # Substituting color-tags from xmp to pp3:
    temp_xmp_color = re.search('digiKam:ColorLabel=\"(.+?)\"', temp_xmp).group(1)
    # DigiKam has 0-9 tags, RawTherapee 0-5.
    # Translate orange to yellow and grey/white/black to none:
    if(int(temp_xmp_color) == 3):
        temp_xmp_color = "4"
    elif(3 < int(temp_xmp_color) <= 6):
         temp_xmp_color = str(int(temp_xmp_color) - 1)
    elif(int(temp_xmp_color) > 6):
        temp_xmp_color = "0"
    temp_pp3 = re.sub('ColorLabel=\d', 'ColorLabel=' + temp_xmp_color, temp_pp3)
    # Overwriting the pp3:
    Path(found_pp3[i]).write_text(temp_pp3, encoding='utf-8')
    i += 1

print("Done!")

I made a gist of this code which now can also work in the opposite direction. It works well for me so far, but again:

NB: This code might damage your sidecar files. It might not work with other versions than DigiKam's 6.3.0 and RawTherapee's 5.7. Make a backup first, then try this!

It should do well, though, especially as long as RawTherapee keeps using Rank= and ColorLabel= without ambiguity (if they rename them, the script will not change anything) and DigiKam does the same with xmp:Rating= and digiKam:ColorLabel=.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.