Generate preview images in gallery in background

How I can generate preview images for ‘gallery view’ in background?
I use a Seafile server on Raspberry Pi 3. And images for gallery generates very slow.
I want run this process in background or as cron task.
Any ideas?

Would be useful, but is not possible.