lenscorrect-ofx is an open-source lens-correction plug-in for DaVinci Resolve. It corrects lens distortion, vignetting, and lateral chromatic aberration from Lensfun calibration data or supported metadata embedded in DNG files. Corrections run as one fused Metal pass on Apple Silicon, with a CPU fallback.
The project exists to make profile-driven correction available to more still and RAW workflows in Resolve, especially where vignette correction or camera metadata handling would otherwise be manual, in light of Davinci Resolve's new Photo page. Its design was inspired by, and its behavior checked against, darktable’s Lens Correction module. The implementation is independent; no darktable source is copied or linked.
This project is possible thanks to the contributors of Lensfun for making the database. If you find that your camera/lens model is not supported, you can make your custom calibrations by following the manual at this article on Pixls.us/. You can also support the community by submitting your calibration data to Lensfun maintainers.
This is version 0.1.0. The current release targets Apple Silicon Macs and DaVinci Resolve. Support for Windows hosts is planned. This version is untested for other OFX-supporting workflows like Nuke, and support for this is not planned.
- Capabilities
- Usage
- Generate profiles from the command line
- Build and install from source
- Development
- Roadmap
- Credits
- Lensfun poly3, poly5, and PTLens distortion models.
- DNG WarpRectilinear, WarpFisheye, FixVignetteRadial, and GainMap metadata.
- Lensfun linear/poly3 and exact DNG per-channel TCA.
- Rectilinear, fisheye, panoramic, equirectangular, orthographic, stereographic, equisolid, and Thoby projection conversion.
- Perspective, roll, automatic fill scaling, reverse distortion, and manual coefficient adjustment.
- Linear-light vignette correction with common scene, display, camera-log, ACES, HLG, and PQ input transfers.
- Bilinear, Mitchell bicubic, and Lanczos-3 reconstruction with black, clamp, or mirror borders.
- Schema-v1 JSON profiles, persistent per-instance profile state, and a shared preset library.
The correction equations, coordinate conventions, interpolation behavior, and profile structure are documented in MODELS.md.
Install the plug-in, restart Resolve, add lenscorrect-ofx to a clip or node, then work through the inspector from top to bottom.
Select the transfer function of the pixels entering this OFX node. Vignetting is evaluated in linear light, so an incorrect choice changes its result. Use Scene Linear only when the incoming image is actually linear.
- Load Preset lists valid profiles found when Resolve scans the plug-in. Choose Load Manually… for a profile elsewhere on disk.
- Generate from Source… reads the original camera file, tries a Lensfun camera/lens match, and falls back to supported DNG opcodes when no Lensfun match exists. Use the original source rather than an export that has lost EXIF or raw metadata.
- Save Current Preset… writes the current calibration and OFX settings to
~/Library/Application Support/lenscorrect-ofx/Profiles/.
Generated and loaded calibration data is embedded in the Resolve project for that plug-in instance. A preset file is only needed for reuse. The preset menu is built during plug-in discovery; restart Resolve after adding preset files outside the plug-in.
Source generation requires uv and ExifTool. The first run may need network access while uv prepares lensfunpy and its Lensfun database.
Correction Strength blends the complete correction from 0% to 100%. Vignette strength is interpolated in exposure rather than raw gain.
Enable or disable the common geometric correction. Profile / Auto uses the model supplied by the profile. Adjust Manually exposes the optical center, radial coefficients, and tangential terms; changing calibration coefficients detaches that section from its raw Lensfun calibration table for the current instance.
Enable or disable source-space, linear-light shading correction. Adjust Manually exposes the radial polynomial when the loaded model permits it. DNG GainMaps remain profile data rather than editable polynomial controls.
Corrective TCA uses full-precision profile data and keeps green as the reference channel. Creative TCA is a separate artistic layer with linear or poly3 controls; it does not overwrite the corrective calibration.
Avoid applying another TCA correction earlier in the image pipeline unless the combination is intentional, as high-contrast edges can be over-corrected.
- Border Handling determines how samples outside the source are filled. Black preserves transparency, clamp repeats edge pixels, and mirror reflects the image.
- Reconstruction Quality selects bilinear for speed/compatibility, Mitchell bicubic for restrained finishing, or Lanczos-3 for maximum detail.
- Capture Settings exposes focal length, aperture, and focus distance. Editing them re-evaluates raw Lensfun calibration tables. When distance metadata is absent, generated profiles use 1000 m.
- Projection, Perspective & Crop controls source/output projection, correction versus reverse warp, automatic fill scale, manual scale, horizontal/vertical perspective, and roll. Disable automatic scale before setting a fully manual crop scale.
With every correction disabled, the plug-in takes an identity path. Lens, vignette, and TCA can otherwise be enabled independently.
The bundled generator writes the public schema v1 format and preserves raw Lensfun calibration knots for capture-state interpolation in C++.
uv run scripts/generate_profile.py --input /path/to/original.dng
uv run scripts/generate_profile.py --input /path/to/original.cr3 --output profile.json
uv run scripts/generate_profile.py --directory /path/to/media --output-dir /path/to/profilesRun uv run scripts/generate_profile.py --help for all options. examples/profile.json shows the current format.
Requirements:
- Apple Silicon Mac running macOS 12 or later.
- DaVinci Resolve.
- Git and Apple’s Command Line Tools (
xcode-select --install). - Homebrew packages: CMake, ExifTool, Lensfun, and
uv.
Install the external tools:
brew install cmake exiftool lensfun uvUpdate local lensfun database (not needed after a fresh install):
lensfun-update-dataNative .lcp parsing is not supported because Adobe's profile format is proprietary. You can still extend the local Lensfun database with Adobe profiles: install Adobe Camera Raw (it's free and it includes Adobe's current lens-profile collection), place any additional .lcp files in the appropriate directory, then run:
lensfun-convert-lcpDefault directories to place your custom .lcp profiles in:
- Windows:
C:\ProgramData\Adobe\CameraRaw\LensProfiles\1.0\ - macOS:
/Library/Application Support/Adobe/CameraRaw/LensProfiles/1.0/
Run lensfun-convert-lcp --help for options. Adobe profiles often undercorrect. While the manual controls in lenscorrect-ofx can refine the result, consider calibrating from RAW photos and contributing corrections to the official Lensfun database.
Clone with the pinned dependency and build:
git clone --recurse-submodules <repository-url> lenscorrect-ofx
cd lenscorrect-ofx
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
make test
sudo cmake --install buildThe install places lenscorrect-ofx.ofx.bundle in /Library/OFX/Plugins/. Quit Resolve before installing, then reopen it.
The direct Make build is also supported:
make test
make verify
make installIf Resolve cached a failed plug-in probe, quit Resolve and run make reset-resolve-cache once before reopening it. Development builds are ad-hoc signed; release packaging can set CODESIGN_IDENTITY to a Developer ID Application identity.
make test exercises CPU correction math, capture-state interpolation, schema-v1 JSON generation and validation, UI contracts, source generation, and Metal source compilation. make verify additionally builds, signs, and validates the OFX entry points.
The main maintenance boundaries are:
src/CorrectionMath.h: CPU reference behavior.src/MetalKernel.mm: field-for-field GPU implementation.src/ProfileCodec.*: schema and capture-state evaluation.scripts/generate_profile.py: metadata extraction and schema-v1 generation.src/LensCorrectorPlugin.*: OFX lifecycle and UI.
Changes to render parameters or correction behavior must keep CPU and Metal layouts/results in sync.
- Support for lower bit-depths as a setting. The current version works in Float32-RGBa.
- Windows host support.
- Windows GPU kernels and a tested CPU fallback.
- Native installers for macOS and Windows, including signing and upgrade handling.
- Broader host/version testing and release automation.
lenscorrect-ofx relies on the work of the Lensfun maintainers, contributors, calibration authors, and database contributors. Python access is provided by lensfunpy, and metadata extraction uses ExifTool by Phil Harvey.
The correction workflow and behavior were informed by and checked against darktable, particularly its Lens Correction module. The DNG path was checked against the Adobe DNG specification and SDK and the Android Open Source Project DNG implementation.
See THIRD_PARTY_NOTICES.md for licenses and detailed attribution. lenscorrect-ofx itself is released under the MIT License.