Automatically optimizing exported image by quality and/or size

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?

Export to tif/png, open in Gimp, export as jpg. In Gimp, you can set more parameters, display a preview of the encoded image to check for artefacts, and display the file size before you click the button.

https://docs.gimp.org/3.0/en_GB/file-jpeg-export.html

4 Likes

I have seen various software that calculates the export size and I even believe one let you set a file size limit. This was a great feature in the days of dial up internet speeds. It could be useful if a developer saw value in creating this option. maybe even for the playraw category we could then aim for a file size not greater than a defined value to upload our results.

2 Likes

Yes

1 Like