Recently, I was exporting images to submit to a competition where there was a minimum and maximum JPEG file size. Naturally, for a competition, you want to submit the best quality you can.
For the competition I was entering, I did repeated exports decreasing the JPEG quality value until the exported file was below the maximum file size. This worked, but was a waste of time and left me with useless oversized JPEGs. So, while watching all these exports go on, my mind wandered off into “how could I escape this drudgery” mode.
I don’t think a solution to this is a core need for darktable, so I’m not going to advocate for a new feature that most people will probably not need or want.
I have yet to play with Lua support, so I don’t really know the limits of what functions they can perform. A question for those that have: would it be possible for a Lua script to iterate through JPEG qualities on exports until the output file size was below a specified size, and then clean up the files that are too big?