Partial Profile Rules - marcapelini/RTProfileSelector GitHub Wiki

This section explains how to set up partial profile rules. The main differences between "partial profile rules" and the "normal" (full profile) rules are:

  • They are always applied after the main processing profile selection
  • They are applied in a cascading way, that is, they're not mutually exclusive, so that as many matching partial profile rules as found by RTPS will be applied
  • The rules can be "ranked" so that they are applied in a particular order should there be more than one matching rule
  • A section or list of sections from the .pp3 file may be specified for the rule, so that only those sections from the matching processing profile will be merged into the destination profile.
  • As of release 1.0.4 (see #2), any keys found in a section from a selected partial profile are now merged into the corresponding section from the existing profile. Previous behaviour was to replace the whole section.

Tip:

  • While creating your partial rules, you may want to take a look at the file RTProfileSelector.log (located in the same folder as the RTProfileSelector executable). The log file is updated every time RTPS is run, and there you will find information about which profile was selected, which partial profiles were applied (and in which order), what .pp3 file was created and where, and any errors that may have occurred. Example:
RT key file: /home/mc/.cache/RawTherapee5-dev/CPB_temp_1.txt
Calling exiftool: exiftool -t -m -q "/media/mc/bkp_interno/Camera/2011/Ferias_2011-03-19_30/P1030431.RW2" > /home/mc/.cache/RawTherapee5-dev/P1030431.txt
Base profile file selected: /home/mc/.config/RawTherapee5-dev/profiles/Default.pp3
Including partial profile: /home/mc/.config/RawTherapee5-dev/profiles/Camera Specific/GF1 - basic.pp3
Including partial profile: /home/mc/.config/RawTherapee5-dev/profiles/Lens Profiles/lens_auto_correction.pp3
  • You may also want to check which entries in the final profile came from which partial rule. As of release 1.0.5, this information is written to the file LastPP3Debug.txt (located in the same folder as the RTProfileSelector executable):
; Base profile file: /home/mc/.config/RawTherapee5-dev/profiles/Default.pp3
...
[Exposure]
; source: /home/mc/.config/RawTherapee5-dev/profiles/Default.pp3
Auto=false
; source: /home/mc/.config/RawTherapee5-dev/profiles/Default.pp3
Clip=0.02
...
; source: /home/mc/.config/RawTherapee5-dev/profiles/Camera Specific/GF1 - basic.pp3
HighlightCompr=100
; source: /home/mc/.config/RawTherapee5-dev/profiles/Camera Specific/GF1 - basic.pp3
HighlightComprThreshold=0
...
[CACorrection]
; source: /home/mc/.config/RawTherapee5-dev/profiles/Lens Profiles/lens_auto_correction.pp3
Red=0
; source: /home/mc/.config/RawTherapee5-dev/profiles/Lens Profiles/lens_auto_correction.pp3
Blue=0

Example: selecting an appropriate LCP profile for a compact camera model

The steps for creating a partial profile rule are the same as for normal rules, so below I will focus on a practical example of how such a rule can be used. Although this example deals with the automatic selection of an LCP profile for a particular camera, the concept is not specific to lens settings: any suitable set of Exif keys and partial .pp3 profiles can be used, just as with normal rules.


I have thousands of photos taken with a Canon Powershot G9. It is an oldish (2008) compact camera, which didn't automatically correct for lens distortion, chromatic aberration or vignetting. Here's a photo taken at the lens's widest setting, showing its typical barrel distortion. Notice that the lens correction controls in RT have assumed their default values, that is, no lens correction is being applied:


  • I have downloaded an LCP file (LCP stands for "lens correction profile") for the Canon Porwershot G9 which, when selected in RT, corrects for both the lens geometrical distortion and vignetting. So let's select the right profile for my camera:

  • Here's the same photo as above with the proper LCP file selected and applied. Notice that the lines are now straight and that the mild light fall off at the edges has been corrected:

Now that I have selected the LCP file for this particular photo, let's save an RT partial processing profile with only the lens correction information, so that it can be later applied to other photos taken with the G9 without changing any other parameter but the LCP selection.

  • Step 1: hold the CTLR key and click the "Save current profile" button.

  • Step 2: give the partial processing profile any suitable name (I preffer to place my partial profiles in a separate folder, as shown below, but that's just me).

  • Step 3: save it, selecting only the "Lens correction profile" option.


Now that we have a .pp3 file with only the LCP selection information, it's just a matter of creating a rule to automatically select that partial profile the first time I open a photo taken with the Canon G9. The problem is: I already have a number of rules to select particular profiles for the G9, and I don't want to change all of those profiles to include the LCP info. What I'm going to do instead is leave my normal rules alone and create a partial profile rule that RTPS will apply after the main rule selection.

The way RTPS identifies a rule as one suitable for partial profiles is by looking for a "@Sections" key in the rule definition section in RTProfileSelectorRules.ini. The "@Sections" key can contain a comma-delimited list of .pp3 file section names (remember that RT's .pp3 file format is just text ini file with a number of sections and keys for RT's processing parameters), or just an asterisk ("*"), meaning any sections found within the processing profile file will be copied to the destination processing profile, overwriting the corresponding sections from the full profile selected by the main rule.

Here is a simple rule that applies the partial processing profile we created in the step above to any photo taken with the "Powershot G9". Notice the presence of a "@Sections=*" entry in the partial profile rule - don't forget to add this to your own partial profile rules, otherwise the whole .pp3 file will be copied to the destination file, instead of being merged into the default or selected profile!


Specifying which sections to merge

In most cases, having "@Sections=*" as in the rule above is the way to go, assuming the processing profile selected by your rule is in fact a partial one (one with just a number of selected sections, not the full set used by RT). However, if you want to further restrict which sections are applied by a partial processing rule, you can specify a comma-delimited list of .pp3 sections so that RTPS will only copy those sections to the destination profile, and not any others that there may have been saved in the file. For example, if I want to make sure that only some lens-related settings are affected by the rule, here is how I might do that:

[Lens Profiles\Canon G9 - Lens.pp3]
@Sections=LensProfile,CACorrection,Vignetting Correction
Canon Model ID=PowerShot G9

Ranking rules: defining the order in which partial profile rules are applied

In case you have more than one partial profile rule that matches the Exif keys from a particular photo, you may want to define the order in which they're applied by RTPS so that important sections from a particular .pp3 file don't get inadvertently overwritten by another profile. In this case, you can assign a "rank" to each rule. A rank is just any integer value that you set via the optional "@Rank" key in your rule. All rules have a default rank of "0". RTPS guarantees that the highest-ranked rules are applied after the lowest-ranked ones. For example, given the two rules below:

[Lens Profiles\Canon G9 - Lens.pp3]
@Sections=*
@Rank=10
Canon Model ID=PowerShot G9

[Noise Profiles\high_noise_partial.pp3]
@Sections=*
@Rank=1
Canon Model ID=PowerShot G9
ISO=400 ~ *

The "Canon G9 - Lens.pp3" will be applied after the "high_noise_partial.pp3" because it has a higher rank. This way, even if the "high_noise_partial.pp3" happens to have been saved with an LCP profile set, that information will be overridden by the one set in the "Canon G9 - Lens.pp3" file.


Previous page: Creating rules

Next page: ISO Profiles