Open wpferguson opened 6 months ago
@dterrahe would it be possible to create a darktable.gui.info()
that leverages the information that darktable.gui.action()
already contains? I'm not asking you to write it, but if it's possible and you can give me some idea where to start it would be appreciated.
This issue has been marked as stale due to inactivity for the last 60 days. It will be automatically closed in 300 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.
Background
When @dterrahe developed InputNG he added a feature that allowed access to the GUI from Lua,
darktable.gui.action()
. It took awhile to understand how to use it and some extensions to the Lua API to make it somewhat bulletproof.For the last year and a half I've been working on ways to automate workflows using the Lua scripting interface. My focus has been mainly on reducing the number of clicks required to process an image. My first thought was to reduce the chance of carpal tunnel, but the more I thought about it I realized that clicks are really time consuming. Simply clicking a module to turn it on is ~5 seconds by the time you find it, move the mouse over it, and click on it. Opening a module and making an adjustment is 3 to 5 times that.
When I started this, my time to process a sports image was 1 to 3 minutes. Now I process them in as little as 5 seconds with the average being 10 - 20 seconds. The only difference in the processing is automation.
My workflow works as follows
I cull, then apply a style that adds 4 instances of diffuse or sharpen (2 denoise presets, AA sharpening preset, local contrast preset), 2 tone equalizers (1 default and 1 contrast curve soft), chromatic aberrations (default), rotate and perspective (default). The module order is customized and all the modules are turned off.
When I open an image in darkroom a script is triggered that checks the path and applies the correct modulegoups preset (i.e. if the path contains the name of a sport, then the Sports module preset is loaded. If it contains Senior Pics, then the Portrait module group is loaded).
Another script checks the path to see if the sport was basketball and who the home team was. I have white balance presets for different basketball courts. Based on the home team, a color calibration preset is applied to correct the white balance.
Once the image is loaded I move the mouse to the histogram and adjust the exposure by scrolling, if necessary. If the image isn't straight, I right click and draw a line so that rotate and perspective corrects it. Then I hit a keystroke combination to apply the "final processing" . Than consists of looking at the ISO and not applying, or applying a combination of denoise profiled and the 2 diffuse or sharpen presets, then chromatic aberrations, then applying the diffuse or sharpen AA sharpening preset, then my colorbalancergb preset, then diffuse or sharpen local contrast, then tone equalizer contrast curve soft. I may go up in the histogram and do a exposure tweak if necessary. Then I hit the space bar and move to the next image. A script is triggered when the image changes and the thumbnail for the previous image is updated so that you don't have to wait for them to regenerate when you switch back to lighttable.
Current Status
Several years ago I had a hazy idea about "smart" styles. I've actually created a Lua script that "creates" the style I described above and applies it to the image in darkroom. I still use the dtstyle version because it's faster and not as fragile.
I've automated my sports workflow. My portrait workflow is still a work in progress. My scripts are purpose written for my workflow so they may or may not work for someone else.
I'm currently working on a timelapse workflow automation. I did a small proof of concept, so now I'm trying to build something usable and useful.
Next Steps
The Lua interface to darktable is good for getting information about things (images, tags, styles, etc) in darktable, but not information about the darktable state. I've been adding events (darkroom-image-loaded, pixelpipe-processing-complete) to the API to get darktable to "talk" to me and let me (my script) know what's going on. But I still can't tell you what preset is active for a module or lib, what modules are in the pixelpipe and in what order. Right now I try and set darktable to a known state (i.e. reset the history stack) then add modules and count hpw many places to move them to put them in the correct place in the pixelpipe. It's a pretty fragile method, which is why I still stick to applying the style with the style interface. So, next step number 1 is to keep adding instrumentation to darktable so a script can tell what the state is and follow the correct code path.
Step number 2 is to figure out ways to make my automatons usable for others, whether by rule sets, or some other method
Step number 3 is to make a repository (maybe wpferguson/workflows) where people can get what I've built and see what they can build from it.
Step number 4 is to add it to the Lua scripts repository