On Sat, Nov 14, 2020 at 10:36 AM Dusenberg <dusenb...@gmx.co.uk> wrote:

> Hi, I'm needing some expert help with my first attempt at a dt lua script.
>
> In the 'final output' stage of my workflow I create images in various
> reduced sizes and formats from developed raws mainly for placing into
> non-darktable managed libraries or to publish. I use imagemagik 'convert'
> to resize at the end of the shrink and reformat process, and exiftool to
> copy metadata from the tifs if required. At present this in a bash script
> outside of dt and is a fairly cumbersome procedure which I really want to
> automate. My idea is to create a new storage target in dt to replace the
> bash script.
>
> It has taken a long time but I've got the basic lua script together with
> code snips taken from the gimp.lua script, image_stack.lua, and others and
> I've been referring to the darktable lua api documentation.  I've got the
> new gui widgets to display and pre-populate with defaults (well most of
> them) but I have lost the standard
> export options for export destination and filename, bit depth, and file
> format. The gimp.lua, and other scripts, automatically create 16bit tifs in
> /tmp without the user having to specify this, but I haven't been able to
> find out how this is done. Also I can't find how to access the standard
> export data fields.  I don't want to test what happens when I press
> 'export' until I've got these basics correct.
>
> My immediate questions I need guidance with are:
>
> 1 - how do I ensure the export is always to /tmp, is 16-bit, and is in tif
> format?
>

The default destination is always dt.configuration.config_dir, which on
Linux and MacOS is /tmp.  You can manipulate the final destination of the
export files, if you want to.

The exporter "remembers" the last format you exported in, so if you export
a 16 bit tif, then the next time you open the exporter that's what it will
be set at.  You can restrict the
choices of file types to tif only with the following code

local function support_format(storage, format) --tells dt we only support
TIFF export type
    local ret = false
    local temp = string.find(format.name, 'TIFF')
    if temp ~= nil then ret = true end
    return ret
end

Specify the function support_format when you declare the register_storage
to implement it.

>
> 2 - how do I ensure the exported tif files use my naming convention?
>

The exported files are sent to tmp as $(FILENAME).tif or whatever export
type you select.  You can retrieve them from there and name them anyway you
want.

>
> 3 - how do I check if metadata was selected for export so I can determine
> if I need to run a metadata copy to the output files?
>

I would leave this up to the settings.  If you want metadata exported, then
pick what you want to export and let the exporter handle it.  If you share
the script and the user doesn't want
to export metadata, but the script checks the file and does it anyway, it
might be a nasty surprise.

>
> Thanks in advance.
>
> I wrote a script, postsharpen.lua, that shows how to do most of what you
asked about.  It exports files to /tmp, the runs convert over them to
sharpen them, then saves them to a different location, with possibly a
different name.

If you want to add them to your existing lua scripts directory just do:

cd ~/.config/darktable/lua
git clone https://github.com/wpferguson/extra-dt-lua-scripts wpferguson

Otherwise, just clone the repository wherever you want.

Bill

> ___________________________________________________________________________
> darktable developer mailing list to unsubscribe send a mail to
> darktable-dev+unsubscr...@lists.darktable.org
>

___________________________________________________________________________
darktable developer mailing list
to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org

Reply via email to