

The remote scp must use password-less copy – scp can’t be provided with a password easily, so we will leave it that way. This script can’t read input from the user. That command might fail, in particular if the user has not correctly set the preference.

We do not check the returned value of scp. We will detail how to do that in the next section. It would be nicer to add an element to the export UI in darktable. We use preferences to configure the target path. This code will work but it has a couple of limitations. It contains the name of a temporary file where the image was exported by darktable’s engine. This function has a lot of parameters, but filename is the only one we use in this example. The first argument is a name for the storage type, the second is the label that will be displayed in the UI and last is a function to call on each image. We then have the label for the preference in the preference menu, the tooltip when hovering over the value and a default value.ĭarktable.register_storage is the call that actually registers a new storage type. It could also be an integer, a filename or any of the types detailed in the API manual relating to types_lua_pref_type. The string field tells the lua engine that the preference is a string. These fields are reused when we read the value of the preference. If not ("scp ".filename." ".ĭarktable.print_error("scp failed for ".tostring(image))ĭ will add a new preference to darktable’s preferences menu, scp_export and export_path allow us to uniquely identify our preference. Can include user and hostname","")ĭarktable.register_storage("scp_export","Export via scp",įunction( storage, image, format, filename,

darktable = require "darktable"ĭ("scp_export","export_path", A new storage type will appear in darktable’s UI that will export images to a remote target via the copy mechanism in ssh. In this next example we will use lua to export via scp.

If you are able to upload an image to a service via the command line then you can use lua to integrate this into darktable’s user interface. Let’s look now at how to use lua to easily export images to an online service. So far we have learned to use lua to adapt darktable to our particular workflow.
