Lens Correction Profile Scripting

Hi,

I’ve written a simple script that takes a folder of RAWs and writes an initial PP3 file (or appends to a current PP3) with the correct Lens Correction Profile information, for example:

[LensProfile]
LCPFile = /path/to/PENTAX (smc PENTAX-DA 35mm F2.4 AL) - RAW.lcp
UseDistortion = true
UseVignette = true
UseCA = false

The idea is that rather than having to manually apply a profile to each picture, I can select the correct profile depending on the focal length of the picture. It’s limited but the looks-up works.

The problem I have is that other (non LCP) config values change in the PP3 when I manually apply the LCP to a RAW image in the the GUI.

I have tried both

  • starting with an initial PP3 file containing just a LCP profile and loading that up in RawTherapee
  • appending the LCP config to a default PP3 already genearted in RawTherapee.

In both cases these 2 outputs are identical (suggesting that a default profile is applied to a RAW that has an incomplete PP3 spec). However they differ to loading the RAW in the GUI and applying the same LCP file manually.

Any ideas why this might be - and assuming the GUI is doing the correct thing, how can I batch set the LCP?

Thanks!

Phil.

Some example differences:

13c13
< Compensation=-0.078132219612598419

Compensation=0
15c15
< Contrast=25


Contrast=0
17c17
< Black=314


Black=0
46c46
< baselog=3


baselog=2.71828
77c77
< MixerRed=43


MixerRed=33
82c82
< MixerBlue=30


MixerBlue=33
152,153c152,153
< Temperature=5470
< Green=0.94699999999999995


Temperature=6504
Green=1
164c164

1 Like

If you want to apply only some settings to an image in GUI, have a look at
http://rawpedia.rawtherapee.com/The_Image_Editor_Tab#Processing_Profile_Selector
The ‘Preserve mode’ could be the one you need to use

1 Like

Hi! Another idea might be using your script as a custom profile builder in RawTHerapee, and adding the section with the LCP info on top of whatever profile was selected as default (or based on any other rule). That’s what I did with my RTProfileSelector (code available on GitHub): RTProfileSelector - RawPedia

3 Likes

I’m a fan of this great piece of software. :slight_smile: Thanks

Thanks

This looks very similar to what I’ve done - but you’ve made the rules editable, and I’ve (crudely) hardcoded them for my lenses.

Does you ProfileSelector compile for MacOSX?

Thanks.

This is useful to know.

So I’m guessing when I create a partial pp3 profile file (containing only an LCP profile), when I load the image in the GUI, the rest of the values are given defaults - just as with Fill Mode as described in the link. You’re right that Preserve mode sounds more like what I want - i.e. I apply the Default profile (or whatever else I want) and then at the end tweak only for Lens correction.

It looks like the default values used to fill-out a partial profile containing only a lens correction, are different to those that you get just by selecting the Default Profile and then applying a Lens Correction in the GUI. I was hoping they’d be identical!

Only problem with the method you describe is that it is the same as selecting a Lens Correction Profile in the GUI - i.e. I have to do it for every file which is what I’m trying to avoid with a batch based command?

Currently in Fill mode missing settings are set with hard-coded defaults (as described in rawpedia). We could discuss whether it’s useful to replace them with values of ‘Default’ profile (which is not hard-coded) instead. Sounds like a not so bad idea to me… @Morgan_Hardwood : what’s your opinion?

If you want to set a lcp for a lot of files at once, you also can select the files in RT file browser and set the lcp.

I don’t have access to a computer running OS X, but it’s easy enough for you to check: all you need is a C++ 11 compiler as there are no compilation dependencies (though you will need to install ExifTool, which I suppose is available on OS X). If you do try to compile and use it, please report back to us as I’m curious on how portable the source code is. :slight_smile:

1 Like

How about creating an optional “Mode” setting in the RT profiles. Then one could select “Fill” or “Preserve” to override the GUI setting.