Lens correction with modern cameras

Hello everybody.

I am a recent user of RawTherapee and a more recent owner of a Canon 7d II. I am reading the camera manual and I see it can provide with lens distortion, vignetting and chromatic aberration corrections for all the lenses I have, so I have a doubt: if I apply these corrections directly on my camera, do I also have to apply the profiled lens correction from RawTherapee? Does RawTherapee take into account corrections are being made directly from the camera?



the in-camera corrections are only applied to JPEGs and not the RAWs, so if you want to edit those RAWs in RawTherapee and want the same corrections applied you have to apply them in RawTherapee too – except for CA correction which is AFAIK better corrected through RT’s RAW-CA-Correction.

To apply them, you can set the lens profile correction to automatically detect your camera and lens or select them manually (both options are using the lensfun-database) and as a second (or third) option there is the possibility to apply a .lcp-file. Just for your information: Not all possible corrections are saved in lensfun, so if there is for example no distortion correction you can try a .lcp-profile which corresponds to your sensor size and lens.

Kind regards,


Thank you very much Max-Set. I have re-read the camera manual and it doesn’t say anything about only applying those corrections to JPEG files, but it makes sense.
The problem I have is only one of my three lenses is supported in lensfun, and in september I opened two issues in github/lensfun with all the data obtained for my missing lenses but no answer yet. Let’s keep the hope they will be included soon.

Kind regards.

You’re welcome :slight_smile:

If your lenses are unsupported you can at least try the automatic distortion correction one module below lens correction. This module tries to mimic the JPEG so this could be an option if you have lens correction data for your lenses in camera.

Another option would be to get .lcp-files like described in the Wiki: http://rawpedia.rawtherapee.com/How_to_get_LCP_and_DCP_profiles

Kind regards,


I found the issues you posted - it’s unlikely the data will be included because there are no photos to test them with. A pull request might get more traction, but the best way would be to upload the photos you used to the calibration service.

Since you’ve profiled the lenses yourself you can use the XML files you created with your local copy of Lensfun. Submission to the project isn’t needed for that.

Hi Karl.

First, thank you for your answer, this seems like a very active forum.

I didn’t know I had to upload the pictures to the issues, but as I still have them, I will upload them now. Before I opened those issues, I tried using the calibration service, but I never got a mail, confirmation of the upload, anything that would assure me that I had done it right, so I tried the other method instead, getting the calibrations by myself and opening an issue.

Could you redirect me to a link where it shows how to use RawTherapee with the XML files I created? I use Windows 10, not Linux, and I thought I had to wait for a new RT release to use new lens corrections, and that I could not use this XML.


PD: I have just tried to upload the pictures to the issue, but the limit is 10MB and the zip file is 194MB.

If the upload was successful there would be a ticket created in Github. It’s been a couple of years since I was involved in the project, so I can’t really speak to what might have happened.

I use Linux, but the process should be the same; you just put the XML files somewhere that Lensfun will find them. According to https://lensfun.github.io/manual/latest/dbsearch.html, the Windows location for custom profiles is %USERSPROFILE%/AppData/Local/lensfun (this must be a folder.)

So you would create this folder (if it doesn’t exist), and put the profile files in there (filenames are unimportant, but they must have the .xml extension. (Don’t zip them or otherwise process them.)

I have looked that folder and I have it, although it was created by me back when I got the XML files, but with no success. Could it be RawTherapee doesn’t use that folder? I guess the folder is just for lensfun installations, not RawTherapee ones.

It’s unlikely that it’s not used; more likely is an issue with the file itself. I took a closer look at the one you uploaded for the EF 75-300mm f/4-5.6 III; you have the lens type parameter with a value of “normal”, which isn’t valid (valid types are “rectilinear", “fisheye”, “panoramic”, “equirectangular”, “orthographic”, “stereographic”, “equisolid”, “fisheye_thoby”.)

Try removing the lens type from the files you have placed in this folder and see if that helps (if it’s not specified, lensfun defaults to “rectilinear”, which should be correct for this lens.)

That was it! Now I have the corrections in RawTherapee! Thank you very much Karl.

What would you suggest me to do in order to try that these lenses appear to all lensfun users? Try the calibration service again? Anything else in case that doesn’t work?

You’re welcome - glad to help. :slight_smile:

You might want to double-check that the corrections work properly on the same images you used for calibration; I noticed that you listed the crop factor for the lens as 1.587, but Lensfun shows the 7d II crop factor as 1.605 - if the calibration images were shot with a crop factor of 1.605, listing 1.587 might produce incorrect results.

Try the calibration service again. 10MB is very, very small for files - raw files produced by my camera are 46MB each, and other current cameras are similar sizes. If the limit is 10MB, then the upload service wouldn’t be able to handle a single image.

If the service still doesn’t work, I’d try emailing Torsten and letting him know (his email address is on the calibration service page.)

I now own a 7D II, but the pictures were taken with a very old Canon D60. I just did the math again and the crop factor for de D60 is ok. I understand there’s no problem of using these corrections with the 7D II, am I right? Would there be a problem with a full frame camera using the corrections for those lenses?

I’ll try again the calibration service as you suggest, and as I said, thank you very much.

Generally you can’t use calibrations done with a smaller sensor on a larger one because there is no data for the area covered by the larger sensor. You can extrapolate the data, but it’s likely to not work because the distortions are typically worse at the edges than at the center (and the edges are the places where you don’t have any data.)

AFAIK Lensfun uses the crop factor data for the lenses to determine whether it can be applied to the image - if the crop factor for a lens is larger than that of the image it won’t present the lens as being available for correction. (I’m not sure if software can override this or not.)

slr-canon.xml shows the 60D crop factor to be 1.613; that’s even smaller than the 7D-II. The difference may be small enough to not matter, but perhaps try some test photos to see if it works well enough for your purposes.

For a full-frame, definitely. As above, Lensfun likely wouldn’t even present them.


I looked that file, slr-canon.xml, and the crop factor for the Canon D60 (it’s very old, previous to the “number+D” format for Canon digital cameras) is 1.587, and the 7D II is 1.605, so I can use the corrections safely :slight_smile:

Ahh, yes - you’re correct. In that case you should be good to go.