Today a client had questions on how to get a lot of thumbnails calculated quickly in Xojo. We do have CGImageSourceMBS class to read various image files and use Apple's image decoders with hardware acceleration, but doing one after the other in Xojo for thousands of image files would still take a long time.
To speed things up, we made a few plugin functions to use preemptive threads to create the thumbnails. You run several Xojo threads and in each process image files and call one of the following methods:
CreateThumbnailMT(file as FolderItem, ImageIndex as integer = 0, Options as dictionary = nil) as CGImageMBS
CreateThumbnailMT(data as String, ImageIndex as integer = 0, Options as dictionary = nil) as CGImageMBS
CreateThumbnailMT(data as MemoryBlock, ImageIndex as integer = 0, Options as dictionary = nil) as CGImageMBS
The main work is done on a preemptive thread, so you can get a lot of CPU cores busy if needed. The returned CGImageMBS objects can be converted to Xojo pictures (Picture method), or you get png or jpeg image data with PNGData or JPEGData methods.
You can pass various options via dictionary to select the thumbnail size or decide whether you like to use thumbnails embedded in images.
Coming soon for next 19.1 prerelease. If you like to try earlier, please email us.
PS: We also add GMConvertMBS class to do the similar things cross platform. You can use it to scale down images for thumbnails with preemptive threads.