Day 25 – Darktable CLI import images ?

Not sure if it is just me who wants that feature but for my current photo workflow to be automated as much as possible I need that. Unfortunately, there seems to be no documented way to import images other than using the GUI. After some research, I came up with an idea though.

Once again, the workflow I want to achieve looks roughly like this.

  • copy images from SD Card to my hard drive and sort them by date and camera model
  • import the new images to Darktable
  • generate preview images (JPEG) from the RAW images

The problematic step is the import. That’s necessary because only then I can use Darktables “darktable-generate-cache” tool to generate the previews.

Why do I need the previews?
Well, performance. If you don’t create the JPEGs upfront, Darktable will do it on demand and that is slow, even on beefy hardware. Often I want to scroll fast through my images and this is just impossible if the previews aren’t there. It might be that this is not an issue if you can use OpenCL, Darktable supports that, but I can’t use it on FreeBSD. Maybe one day OpenCL support will be available. Let’s cross our fingers.

Back to the photo import issue.
I’m still working on the details but the basic idea is this.
Darktable supports Lua, a scripting language. Turns out you can write a script that does the image import. This script will then be called when Darktable starts. So far so good. I don’t have this script yet, so it’s the pure theory at this point.

Let’s assume this will work, then what is left is to close Darktable as soon as the importing is done. Closing is needed because otherwise, you can’t run the preview generation on the command line.

If you are not a Darktable user this was maybe a bit hard to follow 🙂 Sorry for that.
I just wanted to give a bit more insight on what kind of issues I have right now and why it takes so long to set up my toolchain.

I have also spent some time today to look into the source code and evaluate if I can just tweak it to my needs. Well, I guess I could. However, I decided this is the last option. It did not look exactly obvious what needs to be changed in order to achieve what I need.

Let’s make it work somehow first and then see if it can be optimized further.

cu tomorrow

Leave a Comment

Your email address will not be published.