I actually built a script for this a while ago:
It was made for a different purpose, importing/exporting randomized 3D models, but the core functionality of what you are looking for is there. With some slight modifications you can have this up and running:
The script needs to import the files, turn on the render cameras, render and export an image, select, then delete the files (now scene objects) you imported. All of that is looped through the directory you are storing the .glb files in, for each .glb file.
path_to_glb_folder = "/Users/Path/To/Folder" # If you are using Windows use r"\Users\Path\To\Folder"
path_to_jpeg_folder = "/Users/Path/To/Folder"
Deletes all objects in the current scene
deleteListObjects = ['MESH', 'CURVE', 'SURFACE', 'META', 'FONT', 'HAIR', 'POINTCLOUD', 'VOLUME', 'GPENCIL',
'ARMATURE', 'LATTICE', 'EMPTY', 'LIGHT', 'LIGHT_PROBE', 'CAMERA', 'SPEAKER']
# Select all objects in the scene to be deleted:
for o in bpy.context.scene.objects:
for i in deleteListObjects:
if o.type == i:
bpy.ops.object.delete() # Deletes all selected objects in the scene
glb_dirList = os.listdir(path_to_glb_folder)
removeList = [".gitignore", ".DS_Store"] # If you have . files in your directory
glb_dirList = [x for x in glb_dirList if (x not in removeList)]
for i in glb_dirList:
bpy.ops.import_scene.gltf(filepath=os.path.join()) # Import .glb file to scene
bpy.context.scene.render.filepath = path_to_jpeg_folder # Set save path for images
bpy.context.scene.render.image_settings.file_format = "JPEG" # Set image file format
bpy.ops.render.render(write_still=True) # Tell Blender to render an image