Don’t Forget the Lua scripts


(Tobias) #1

It is possible to extend darktable with Lua scripts. In this repository you can find some nice extensions for darktable:

If you like to write your on scripts, there is an extra subfolder with examples:

And here you can find the API reference:
https://www.darktable.org/lua-api/index.html.php


Lua scripts in Darktable. How to?
#2

Hello Group, glad to see you here!

Among the scripts that Tobias informed about above, the one which I recommend you to start with is the hello_world.lua script. You will find it in the examples folder (not in the official folder, which the readme says). It is easy to install and it will give you rapid feedback that you managed to set it up or not.

Then I suggest the script which I presently find most useful: gimp.lua. It permits you to send an image from darktable straight into The Gimp.


(Amir) #3

Thanks for the tip! I am definitely going to try the Hugin script out.

I am wondering how the exported output from Hugin (or Gimp, for that matter) is meant to be imported back into the darktable collection (e.g. for further export to an online gallery.)


(Isaac Ullah) #4

Thanks for the reminder about LUA scripting in DT. It’s something I haven’t looked too much into yet, but definitely want to do so!


(Bill Ferguson) #5

When you are done editing in GIMP, save your changes to the exported file (choose file->OVERWRITE xxxx). Exit GIMP discarding changes and the exported file that you overwrote will be imported into darktable and grouped with the original image.

hugin leaves it’s output file in $HOME/.local/tmp You can manually move it into the directory you want, then re-import the folder into darktable to add it to the collection.


(Steve Marquis) #6

wpferguson can you please tell this newb how to install your lua script into darktable (windows) or point me to a how to please? I’m just learning darktable and just came across NIK for HDR and a google search came up with your collection. I don’t know where to bung it into the Darktable directory (if that’s what you do).
Many thanks
Steve


(Mica) #7

This thread should be helpful: Lua for darktable on Windows


(Bill Ferguson) #8

Hi Steve,

Those scripts you found won’t run in the current lua environment. The are built to run on top of a plugin interface that I’m working on, but that isn’t finished. In the meantime, I will do some exporter nik collection scripts that should be done by next week.

Bill


(Steve Marquis) #9

Sorry Bill, I misunderstood their usage. I got over-excited seeing them :smiley:

Steve


#10

Thanks for the reminder!

A few things about the scripts repo… The first thing I tried was to symlink individual scripts into my ~/.config/darktable/lua directory, but that really breaks down when you hit scripts that require stuff from the lib folder. The best way really is to just clone the repo straight in there or symlink it. e.g. a simpler setup instruction would be:

cd ~/.config/darktable
git clone https://github.com/darktable-org/lua-scripts/
ln -s lua-scripts lua

Then individual plugins can be enabled with:

echo 'require "contrib.rate_group"' >> luarc

Changes need Darktable to be restarted of course.

My luarc currently has this:

local dt = require "darktable"
dt.print("loading luarc...")

require "contrib.copy_attach_detach_tags"
require "contrib.fujifilm_ratings"
require "contrib.gimp"
require "contrib.hugin"
require "contrib.rate_group"
require "official.image_path_in_ui"

dt.print("luarc loaded")

I found it useful to give visual feedback for process because, as it turns out, I had trouble loading some plugins when using the first approach (of symlinking individual scripts instead of the whole repo). Using dartable -d lua is also essential in debugging issues with those scripts, which are totally silent (even on failure) by default.

Of the above, I think the “group rate” plugin is the most important, and should really be enabled by default… I haven’t tried the others just yet, but I’m curious to see where it brings me.

So thanks for bringing up this topic again, I was just trying to figure out how to “group rate” recently and I am really happy to have found that little gem!

(PS: I wonder how much of the above would belong in the README file? It would certainly have saved me some time if this was spelled out a little more clearly…)


(Tobias) #11

Thanks for the feedback, I’ve added some of the informations you suggested:

What do you think should we add more? Improvements and pull requests for are always welcome.


#12

I’ll look into a PR, but it already looks much better. I’d probably use enabling instead of enableling :slight_smile:


(Tobias) #13

I’d probably use enabling instead of enableling

Fixed