darktable Lua scripts

repository·master·Indexed 42 days ago

https://github.com/darktable-org/lua-scripts

A collection of official, community-contributed, and example Lua scripts for darktable. This repository provides extended functionality, automation, and tools through the darktable Lua scripting interface, including scripts for metadata management, HDR blending, facial recognition, and API demonstration.

Tokens
2.9K
Snippets
4
Records
11
Agent score
3%

What's inside darktable Lua scripts

  1. Overview of darktable Lua scripts

    master
    darktable can be customized and extended using the Lua programming language. This repository serves as a collection of official scripts maintained by darktable developers, contributed scripts from the community, example scripts for API demonstration, and tools for managing the repository and documentation.
  2. Install the Lua scripts repository

    master

    The recommended installation method is to clone the repository using git into your darktable configuration directory. This ensures dependencies are met and allows for easy updates. Note that AppImage packages do not support Lua scripts as they lack an internal Lua interpreter.

    Select the command corresponding to your installation method:

    • Snap: Clone into ~/snap/darktable/current
    • Flatpak: Clone into ~/.var/app/org.darktable.Darktable/config/darktable
    • Linux/MacOS: Clone into ~/.config/darktable/
    • Windows: Clone into %LOCALAPPDATA%\darktable (ensure darktable has been run at least once to create this directory).
    # Example for Linux/MacOS
    cd ~/.config/darktable/
    git clone https://github.com/darktable-org/lua-scripts.git lua
    
    # Example for Windows (Command Prompt)
    cd %LOCALAPPDATA%\darktable
    git clone https://github.com/darktable-org/lua-scripts.git lua
  3. Enable Lua scripts via luarc

    master

    Darktable loads scripts by reading a plain text file named luarc located in your darktable configuration directory. Each line in the file must follow the format require "<directory>/<name>".

    Recommended Approach: Enable the script_manager module, which provides a UI for managing scripts.

    Manual Approach: You can create or append to the luarc file using command-line tools like echo.

    Configuration Locations:

    • Linux/MacOS: ~/.config/darktable/luarc
    • Windows: %LOCALAPPDATA%\darktable\luarc
    • Snap: ~/snap/darktable/current/luarc
    • Flatpak: ~/.var/app/org.darktable.Darktable/config/darktable/luarc
    # Enable script manager on Linux/MacOS
    echo 'require "tools/script_manager"' > ~/.config/darktable/luarc
    
    # Add a specific script (e.g., hugin) on Windows
    echo require "contrib/hugin" >> %LOCALAPPDATA%\darktable\luarc
  4. Debug Lua scripts

    master

    If scripts are not behaving as expected, you can run darktable with Lua debugging enabled to see detailed information in the terminal or a log file.

    Commands by Platform:

    • Snap: snap run darktable -d lua
    • Linux: darktable -d lua
    • MacOS: /Applications/darktable.app/Contents/MacOS/darktable -d lua
    • Windows: "C:\Program Files\darktable\bin\darktable" -d lua > log.txt (run from a command prompt)
    # Linux debugging
    darktable -d lua
  5. Access Lua script and API documentation

    master

    The project provides several documentation resources:

    • Lua Scripts Manual: Documentation for specific scripts (transcribed from header comments).
    • Lua Scripts Library API Manual: Documentation for the libraries and functions provided by the scripts.
    • Lua API Manual: Documentation for the core darktable Lua API.
    • Darktable User Manual: General information about scripting with Lua.
  6. Reference of Tool scripts

    master

    Tool scripts perform functions related to the repository, such as generating documentation. They are located in the tools/ directory.

    NameStandaloneOSPurpose
    executable_managerYesLMWManage the external executables used by the lua scripts
    gen_i18n_moNoLMWGenerate compiled translation files (.mo) from source files (.po)
    get_lib_manpagesNoLMRetrieve the library documentation and output it in man page and PDF format
    get_libdocNoLMWRetrieve the library documentation and output it as text
    script_managerNoLMWManage (install, update, enable, disable) the lua scripts
  7. Reference of Contributed darktable scripts

    master

    Contributed scripts are maintained by community members and are located in the contrib/ directory. They are categorized by whether they are Standalone and their supported Operating Systems (L: Linux, M: MacOS, W: Windows).

    NameStandaloneOSPurpose
    AutoGrouperYesLMWGroup images together by time
    autostyleYesLMWAutomatically apply styles on import
    auto_tag_modifiedYesLMWAutomatically tag images which have been manually modified in the darkroom
    change_group_leaderYesLMWChange which image leads group
    clear_GPSYesLMWReset GPS information for selected images
    CollectHelperYesLMWAdd buttons to selected images module to manipulate the collection
    color_profile_managerYesLMWManage darktable input and output color profiles
    copy_attach_detach_tagsYesLMWCopy and paste tags from/to images
    cr2hdrYesLProcess image created with Magic Lantern Dual ISO
    cycle_group_leaderYesLMWcycle through images of a group making each the group leader in turn
    dbmaintYesLMWfind and remove database entries for missing film rolls and images
    enfuseAdvancedNoLMWMerge multiple images into Dynamic Range Increase (DRI) or Depth From Focus (DFF) images
    exportLUTYesLMWCreate a LUT from a style and export it
    ext_editorNoLWExport pictures to collection and edit them with up to nine user-defined external editors
    face_recognitionNoLMIdentify and tag images using facial recognition
    fujifilm_dynamic_rangeNoLMWCorrect fujifilm exposure based on exposure bias camera setting
    fujifilm_ratingsNoLMSupport importing Fujifilm ratings
    geoJSON_exportNoLCreate a geo JSON script with thumbnails for use in ...
    geoToolboxNoLMWA toolbox of geo functions
    gimpNoLMWOpen an image in GIMP for editing and return the result
    gpx_exportNoLMWExport a GPX track file from selected images GPS data
    harmonic_armatureYesLMWprovide a harmonic armature guide
    hif_group_leaderYesLMWchange the group leader in a raw+heif image pair to the heif image
    HDRMergeNoLMWCombine the selected images into an HDR DNG and return the result
    huginNoLMWCombine selected images into a panorama and return the result
    image_stackNoLMWCombine a stack of images to remove noise or transient objects
    image_timeYesLMWAdjust the EXIF image time
    jpg_group_leaderYesLMWchange the group leader for a raw+jpg pair to the jpg image
    kml_exportNoLExport photos with a KML file for usage in Google Earth
    LabelsToTagsYesLMWApply tags based on color labels and ratings
    OpenInExplorerNoLMWOpen the selected images in the system file manager
    passport_guideYesLMWAdd passport cropping guide to darkroom crop tool
    passport_guide_germanyYesLMWAdd passport cropping guide for German passports to darkroom crop tool
    pdf_slideshowNoLMExport images to a PDF slideshow
    photilsNoLMAutomatic tag suggestions for your images
    quicktagYesLMWCreate shortcuts for quickly applying tags
    rate_groupYesLMWApply or remove a star rating from grouped images
    rename_imagesYesLMWRename single or multiple images
    rename-tagsYesLMWChange a tag name
    RL_out_sharpNoLWOutput sharpening using GMic (Richardson-Lucy algorithm)
    select_non_existingYesLMWEnable selection of non-existing images in the the currently worked on images
    select_untaggedYesLMWEnable selection of untagged images
    slideshowMusicNoLPlay music during a slideshow
    transfer_hierarchyYesLMWImage move/copy preserving directory hierarchy
    video_ffmpegNoLMWExport video from darktable
    website_gallery_exportNoLMWExport a website gallery for selected images
  8. Reference of Example scripts for API demonstration

    master

    Example scripts are located in the examples/ directory. They are intended for demonstration purposes to show how to use specific portions of the darktable Lua API. They are categorized by whether they are Standalone and their supported Operating Systems (L: Linux, M: MacOS, W: Windows).

    NameStandaloneOSPurpose
    api_versionYesLMWPrint the current API version
    darkroom_demoYesLMWDemonstrate changing images in darkroom
    gettextExampleYesLMHow to use translation
    gui_actionsYesLMWdemonstrate controlling the GUI using darktable.gui.action calls
    hello_worldYesLMWPrints hello world when darktable starts
    lighttable_demoYesLMWDemonstrate controlling lighttable mode, zoom, sorting and filtering
    moduleExampleYesLMWHow to create a lighttable module
    multi_osNoLMWHow to create a cross platform script that calls an external executable
    panels_demoYesLMWDemonstrate hiding and showing darktable panels
    preferenceExamplesYesLMWHow to use preferences in a script
    printExamplesYesLMWHow to use various print functions from a script
    running_osYesLMWPrint out the running operating system
    x-touchYesLMWdemonstrate how to use an x-touch mini MIDI controller to control the darktable GUI
  9. Reference of Official darktable scripts

    master

    Official scripts are maintained by darktable developers and are located in the official/ directory. They are categorized by whether they are Standalone (can be run by themselves) and their supported Operating Systems (L: Linux, M: MacOS, W: Windows).

    NameStandaloneOSPurpose
    check_for_updatesYesLMWCheck for updates to darktable
    copy_paste_metadataYesLMWCopy and paste metadata, tags, ratings, and color labels between images
    delete_long_tagsYesLMWDelete all tags longer than a specified length
    delete_unused_tagsYesLMWDelete tags that have no associated images
    enfuseNoLExposure blend several images (HDR)
    generate_image_txtNoLGenerate txt sidecar files to be overlaid on zoomed images
    image_path_in_uiYesLMWPlugin to display selected image path
    import_filter_managerYesLMWManager for import filters
    import_filtersNoLMWTwo import filters for use with import_filter_manager
    save_selectionYesLMWProvide save and restore from multiple selection buffers
    selection_to_pdfNoLGenerate a PDF file from the selected images