Additional darktable lua scripts

I’ve created a repository of additional darktable lua scripts. It’s located at GitHub - wpferguson/extra-dt-lua-scripts: Extra lua scripts for darktable that can't or wont be included in the distributed darktable-org/lua-scripts. It contains scripts that were rejected from the official repository, scripts that can never be included in the official repository, and works in progress.

For the last several months real life has conspired to severely limit my coding time. The works in progress are eventually destined for the official repository, but they aren’t finished yet. But, they do work (at least for me) and have the core functionality to make them useful.

All of the scripts depend on the darktable lua-scripts libraries. The best way to install the extra scripts is in a subdirectory under the lua scripts directory. Instructions are at https://github.com/wpferguson/extra-dt-lua-scripts/README.md.

Currently the repository has the following scripts:

export2collection - I got the idea from watching Harry Durgin’s videos and wrote a script to save some steps and time.

dxo_photolab - Send an image out to dxo photolab for editing and return the result.

adjust_time - Synchonize image timestamps when 2 cameras are used to one event

correct_lens - Modify the detected lens information so your lens shows up as 100-400mm F5-6.3 DG OS HSM | Contemporary 017 instead of (638).

postsharpen - sharpen images after export using Imagemagick’s sharpen or unsharp-mask sharpeners.

I have several more works in progress, mostly targeted at the development version of darktable. I’ll add enough comments so that people can figure out how to use them and then add them here.

Bill

5 Likes

Thanks @wpferguson! Post sharpen looks awesome. Might have to modify it to work with gmic’s RL deconvolution or octave sharpening, both of which work really nicely.

Hope real life eases up!

@paperdigits I thought about using gmic, but I understood Imagemagick better. I think including other sharpening engines is a good idea. I could probably make the sharpening engines a little more modular so that adding an extra is obvious and no big deal. Perhaps we could even do multi stage sharpening using different engines.

Oh la la… Multiple engines… Fancy!

1 Like

@paperdigits, I pushed a new version of postsharpen.lua. I added presets and made the engine definitions modular. I also added gmic and a definition for R/L deconvolve. I also added MacOS and Windows compatibility.

1 Like

Hi Bill,

am really curious to look at post-sharpen.
Quick question: are those scripts also valid/working for DT3.0?

While trying to load postsharpen I see the following output in via “darktable -d lua”
4,399532 LUA processing unsharp_mask_sigma
4,399561 LUA processing unsharp_mask_threshold
4,399577 LUA processing unsharp_mask_amount
4,399591 LUA processing unsharp_mask_radius
4,399605 LUA processing richardson_lucy_deconvolve_sigma
4,399618 LUA processing richardson_lucy_deconvolve_iterations
4,399632 LUA processing richardson_lucy_deconvolve_blur
4,399666 LUA ERROR : Invalid index for combo box : 100

not sure what is happening here, as I defintely am NOT a prfound LUA coder … … :wink:

Any hints?

Thank you very much for your work and best regards, Martin

1 Like

Yes, these run under dt 3.0.

The way to fix this error is open your darktablerc file and delete any line that starts with

lua/postsharpen/...

Save the file and try again. The cause is that I save the settings in one long string and split it apart. I’m guessing you had an older version and updated to the new version. When that happened the old settings string was still there and got picked up when you loaded the script and caused the invalid index. You could try changing the line

lua/postsharpen/initialized=TRUE

to

lua/postsharpen/initialized=FALSE

which should cause the script to regenerate all it’s settings.

This is why it’s still a work in progress :blush:

Bill

Hi Bill,

perfect. That made it work!
Appreciate your help and super work in progress.
Merry Christmas!

Martin

Hi Bill,
I just found these and understand it’s a WIP and I appreciate your work. I’m still learning about the different methods used by your post sharpen but when running the RL Deconvolce it hangs or I get the following:

667.997163 LUA image format is jpg
668.011689 LUA found 3 engines
668.011732 LUA processing sharpen_radius
668.011820 LUA processing sharpen_sigma
668.011887 LUA processing unsharp_mask_threshold
668.011923 LUA processing unsharp_mask_sigma
668.011958 LUA processing unsharp_mask_radius
668.012018 LUA processing unsharp_mask_amount
668.012062 LUA processing richardson_lucy_deconvolve_cut
668.012098 LUA processing richardson_lucy_deconvolve_sigma
668.012131 LUA processing richardson_lucy_deconvolve_blur
668.012164 LUA processing richardson_lucy_deconvolve_iterations
670.011025 LUA exporting 20191123_0008.NEF to /tmp/20191123_0008_01.jpg
670.016932 LUA took the adjustment
670.016968 LUA in sub1...
670.017067 LUA sharpen_opts are  1.00,10,1,1 
670.020960 LUA exported image filename is /tmp/20191123_0008_01.jpg
670.034690 LUA ERROR : /home/dave/.config/darktable/lua/wpferguson/postsharpen.lua:457: attempt to concatenate a boolean value (local 'prog')
stack traceback:
	[C]: in metamethod '__concat'
	/home/dave/.config/darktable/lua/wpferguson/postsharpen.lua:457: in function </home/dave/.config/darktable/lua/wpferguson/postsharpen.lua:405>
875.525054 LUA ERROR : attempt to call a nil value
stack traceback:
	[C]: in ?
	[C]: in ?

I’m running darktable 3.0 under Ubuntu 19.10.
If none of this is useful to you then ignore it.
Thanks again,
Dave

Hmmm, looks like I have an error. I’ll look at it and see what’s going on.

Thanks,

Bill

While you’re looking I got this trying to add your export2collection:

LUA ERROR : ...e/.config/darktable/lua/wpferguson/export2collection.lua:47: attempt to index a nil value (global 'du')

Again, I hope I’m helping!

correct_lens seems nice because the latest darktable version broke my EF-M 15-45. Now I only see (4153).

Fixed, and yes I appreciate the help

Thanks,

Bill

Do you have gmic installed? If not, that would result in prog being false (which I should have checked for). I should probably rethink the initialization and not give you the option to use certain methods if the executable isn’t available. I guess this means that I should also check for the applicable gmic scripts before I offer them.

In the meantime the workaround would be to ensure gmic is installed and in the path and the gmic scripts are up to date.

If gmic is installed and in the path, then start tools/executable_manager and clear the executable path for gmic.

Thanks,

Bill

Ha ha! Turns out I did not. Working fine now. New Mint install for the new year.

Here’s what I got trying to run import2collection (appears as “file to collection” in target storage):

889.716756 LUA ERROR moving /tmp/20200102-ames_estate_fence-60.tif to /home/dave/darktable/photos/2020/2020-01/01-02-ames_estate_fence/20200102-ames_estate_fence-60.tif
    889.716949 LUA ERROR : ./wpferguson/export2collection.lua:142: attempt to call a nil value (global 'checkIfBinExists')
    stack traceback:
    	[C]: in global 'checkIfBinExists'
    	./wpferguson/export2collection.lua:142: in upvalue 'file_move'
    	./wpferguson/export2collection.lua:169: in function <./wpferguson/export2collection.lua:149>

I pulled that one out, dusted it off, and put it in the collection. It appears that it was a little dustier than I thought. Give me a day or two and I’ll just rewrite it and get rid of all the cruft.

Thanks,

Bill

Took out all of the old function calls and replaced them with the library routines. Did a couple of exports, this time, to make sure it works.

1 Like

Thanks! I’m looking forward to using it.