Question: How can one autogenerate a thumbnail for a .blend file with a custom resolution
TLDR: How does Blender generate a thumbnail of a .blend file?
Blender has a tool called "blender-thumbnailer", which file managers use to generate/fetch images (previews) of the .blend files. These previews are in a set reselution of 128x128, in some cases even smaller if the blender window was scaled in some way when saving the file.
Above is an example of a .blend file which has been saved, and the thumbnail (preview) is successfully fetched by the program blender-thumbnailer by providing the following arguments:
blender-thumbnailer <input.blend> <output.png>
Above is an example of a .blend file with a generated preview image of the 3D file. The same command, blender-thumbnailer, has been run on it. However the difference between the two thumbnails can be noted:
Saved .blend file has:
- UI menu
- Background rendered
- Material view
Generated .blend file has:
- No UI menu
- No background rendered (white background, the same on all .blend files with generated thumbnail)
- No material rendering
The saved .blend file is essentially a screenshot taken upon saving the file. That can be concluded by looking at the missing UI menu of the auto generated .blend file. The autogenerated thumbnail somehow generates the thumbnail in a background process, and I want to replicate that so I can have a custom resolution set for these thumbnails.
What I have attemped to autogenerate my own thumbnails for .blend files:
Using python and blenders API there are three operators I have tried to use
bpy.ops.screen.screenshotThis requires the .blend file to be open, which is neither optimal - or what I assume happens when blender-thumbnailer generates the preview
bpy.ops.render.openglRequires opengl, which can not be run as a background process
bpy.ops.wm.previews_batch_generateI do not know how to save the output of this operation, and therefore don't know if this is a way to generate previews. Either way, there is no option (to my knowladge) of scaling the output to a custom resolution