Fastest way to generate small Jpegs for entire catalog using the SDK?
Hi,
I'm trying to build a plugin that brings content-aware search to Lightroom via open_clip AI models. The plugin works well, but to build the search index, I need a (small) Jpeg of each photo in the catalog. Exporting everything via an exportSession works, but is painfully slow (about 2 photos/second).
Instead, I tried exporting everything via the requestJpegThumbnail method (see code below, wrapped with some other code in startAsyncTask), but oftentimes this for loop exits after exporting only parts of my catalog. This is problematic because the code that comes after this is reliant on having all the Jpegs available.
Does anyone know a reliable, fast way to get Jpegs for all images in a catalog?
for _, photo in ipairs( selectedPhotos ) do
local uuid = photo:getRawMetadata("uuid")
local previewname = uuid .. ".jpg"
local holdRefObj = photo:requestJpegThumbnail(320, 320, function( success, failure )
local f = io.open(folder .. previewname,"wb")
f:write(success)
f:close()
end )
end