Access to darktable cached images from lua

Hello !
The lua api allow to call image:generate_cache().
I would like to know if there is a way to know the path of a cached image from lua.
The code in lua/image.c doesn’t seem to expose that information.
Before trying to propose new code to handle that I wanted to be sure.

Thanks

What are you trying to accomplish?

When you generate the cache images darktable knows where to find them and uses them. If they don’t exist, then darktable generates what it needs.

I need thumbnail of the images to put in ressources of the web gallery I build with a lua script.
It’s not efficient to ask darktable to produce export for an image in thumbnail format if the image already exists in the cache. For a thumbnail image I don’t need to ensure all the pipeline has been applied.

On my system (Ubuntu 22.04) the cache images are at ~/.cache/darktable/mipmaps-<some hex string>/<mipmap size (0-8)/imgid.jpg

I do use multiple versions of Darktable on my computer so I have multiple mipmaps dir in ~/.cache/darktable.
Beside I find it awkward to search for image in mipmaps cache when darktable can tells me where it is.