A Darktable Lua plugin that enables automated export of images to UltraHDR (Ultra HDR JPEG) format using darktable-cli and XMP copy modification.
This plugin creates UltraHDR images by:
- Exporting the SDR JPEG using Darktable's standard export
- Copying and modifying the image's XMP sidecar to adjust Sigmoid target display luminance
- Using darktable-cli to export HDR version as 32-bit float OpenEXR with Rec2020 linear profile
- Converting the HDR OpenEXR to RGBA float16 raw buffer using ImageMagick
- Merging both images using
ultrahdr_appto create the final UltraHDR JPEG
The plugin integrates directly into Darktable's export dialog as a custom storage target, making UltraHDR export as simple as selecting it from the storage dropdown.
-
Darktable 4.0 or later
- The plugin requires API version 7.0.0 or higher
- Download from: https://www.darktable.org/
-
darktable-cli
- Command-line interface for Darktable (included with Darktable installation)
- Used for HDR export with modified XMP
- Windows: Usually in
C:\Program Files\darktable\bin\darktable-cli.exe - Linux: Typically
/usr/bin/darktable-cli
-
ultrahdr_app
- Command-line tool for creating UltraHDR images
- Source: https://github.com/google/libultrahdr
- Windows: Bundled with this plugin as
ultrahdr_app.exe - Linux: Must be compiled from source or obtained separately
-
ImageMagick
- Required for converting EXR to raw buffer format
- Download from: https://imagemagick.org/
- Linux:
sudo apt install imagemagick - Windows: Download installer from official site or
winget install ImageMagick.ImageMagick
- Images must have XMP sidecars (process them in Darktable first)
- Images must use the Sigmoid tone mapping module (only on instance)
- Sigmoid must be enabled and configured in the pixelpipe
cd ~/.config/darktable/lua
git clone https://github.com/Mikayex/dt_ultrahdr
cd %LOCALAPPDATA%\darktable\lua
git clone https://github.com/Mikayex/dt_ultrahdr
Add a line to the luarc require "dt_ultrahdr/ultrahdr_export".
If you are using script_manager to manage your scripts, then you will see a new category, dt_ultrahdr. Select that and enable/disable the script.
Open terminal and change directory to the dt_ultrahdr directory. Do a git pull.
-
Open Export Module in Darktable
-
Select "UltraHDR" from the storage dropdown
-
Configure executables (if needed):
- ultrahdr_app: Auto-detected if bundled, otherwise set manually
- magick: Uses PATH by default, set manually if needed
- darktable-cli: Auto-detected, set manually if needed
-
Configure output pattern (optional):
- Default:
$(FILE_FOLDER)/darktable_exported/$(FILE_NAME) - Supports Darktable's variable substitution syntax
- Example:
$(FILE_FOLDER)/ultrahdr/$(FILE_NAME)_uhdr
- Default:
-
Adjust quality settings:
- Target Display Luminance: 100-1600 nits (default: 1600)
- Gainmap Quality: 1-100 (default: 95)
- Gainmap Downsampling: 1-128, rounded to power of 2 (default: 1)
Settings are saved automatically and persist across Darktable sessions.
- Process images in Darktable darkroom (creates XMP sidecars)
- Ensure Sigmoid module is enabled with your desired settings
- Select images in Lighttable
- Open Export module
- Select "UltraHDR" from storage dropdown
- Configure output settings (optional)
- Click Export
The plugin will:
- Validate dependencies before starting
- Process each image automatically
- Create UltraHDR JPEG files based on output pattern
- Clean up all temporary files
- Report completion status
- Filename: Based on configured output pattern +
.jpgextension - Location: Configurable via output pattern (supports variables)
- Format: UltraHDR JPEG (backward-compatible with standard JPEG viewers)
- Overwrite: Optionally create unique filenames instead of overwriting
For each image, the plugin:
- Exports SDR JPEG using standard Darktable export (respects format settings)
- Reads the image's XMP sidecar file
- Decodes Sigmoid parameters from hex-encoded binary data
- Modifies
display_white_targetto the configured target luminance - Encodes modified parameters back to hex
- Writes modified XMP to temporary file
- Uses darktable-cli to export HDR EXR with modified XMP
- Converts EXR to RGBA float16 raw buffer via ImageMagick
- Calls ultrahdr_app to merge SDR and HDR into UltraHDR JPEG
- Cleans up all temporary files