# Lens profiles from a lens database Raws that carry no lens correction of their own (DNG `OpcodeList3`, or a camera correction a raw reader converts, see [sony-lens-corrections.md](sony-lens-corrections.md)) can be corrected from a **lens database in the lensfun XML format** that you supply. The app does not ship any lens database: lensfun's data is licensed CC-BY-SA 3.0 and stays a separate download. Adobe LCP profiles are never used. ## Setup 1. Get the lensfun database (the `data/db/*.xml` files of , or the copy a Linux distribution installs under `/usr/share/lensfun/version_1/`). 2. Point `LIGHTCRAFT_LENSFUN_DIR` at that directory and start the app (or the CLI). Files are read once per process. Invalid files are skipped with a warning in the log. Without the variable nothing changes. ## What is applied The lens is identified from EXIF: camera make / model (for the mount and crop factor; the 35 mm equivalent focal length is used when the camera isn't listed) and the lens model string. Lens names match on their words; every number (focal lengths, apertures) in the database name must appear in the EXIF name, and the lens maker must agree when the file names one. | Correction | Models | Interpolated over | |---|---|---| | Distortion | `poly3`, `poly5`, `ptlens` | focal length | | Lateral CA (TCA) | `linear`, `poly3` | focal length | | Vignetting | `pa` | focal length, aperture (in stops), focus distance (nearest calibrated, by 1/d; infinity when unknown) | Fisheye and other non-rectilinear lenses get no distortion correction. The profile is converted by least squares into the DNG `WarpRectilinear` / `FixVignetteRadial` polynomials, so it goes through the same path as embedded corrections: **Enable Profile Corrections** and its Distortion / Vignetting amounts, the CPU and GPU geometry stage (one resample), orientation handling and DNG export. A conversion whose radial error exceeds 0.001 of the half diagonal, or that would fold the image, is not applied. Normalisation follows lensfun's documentation: distortion and TCA radii are 1 at half the shorter side of the calibration frame (its `cropfactor` and `aspect-ratio`), vignetting radii 1 at its corner; the optical centre is the image centre (lensfun's `
` offsets are not read). ## Limits - Only raws: rendered images (JPEG, HEIF, TIFF) are often already corrected in camera. - The focus distance is not read from maker notes yet: vignetting uses the farthest calibrated distance. - No manual make / model picker yet; matching is automatic. - Not yet validated against real photos and another renderer; the tests use synthetic profiles and grids.