Put this script in your path (e.g.,: ~/bin/blend-export):

#!/usr/bin/env bash

DIR=$(dirname "$0")
blender "$1" --background -noaudio -P "$DIR/blender/"

This refers to a python script that you can put in ~/bin/blender/

import bpy
import os

filepath = os.path.basename(
basepath = os.path.splitext(filepath)
output_file_path = basepath[0] + ".gltf"

bpy.ops.export_scene.gltf(filepath=output_file_path, export_format="GLTF_EMBEDDED")

This is straight forward:

  • The bash scripts open a blend file in blender, in the background, and directly executes a script
  • The script uses the blender api to convert the current scene to gltf

Learn more here:


A neat trick: you can use the fake-bpy-module python module to get auto-completions in your editor.

On arch linux, you can find this in the AUR


Finally, I like to have this action in my context menu. I can even convert a bunch of blend files in on click.

To do this, go in the Edit > Configure custom actions menu and add a new entry.


  • Name: blend to gltf
  • Command: for file in %F; do /home/geo/bin/blend-export "$file"; done

Appearance condition

  • File Pattern: *.blend
  • Appears if selections contains: other files

You can find this in my dotfiles.