← All notes

Blender headless: background render and Python scripts

Untested: iinventedlight has not run the commands in this note. They are restated from the cited docs (checked 2026-10-31). Check them yourself before relying on them.

blender was not on PATH (2026-10-31). Live docs HTML was blocked by Cloudflare; flags below match the official manual source and a 2025-10-17 snapshot of the HTML [S1][S2]. Do not start GPU renders on a shared machine while another job is using the GPU.

Summary

blender --background (or -b) runs without a UI [S1]. Put the .blend before output and frame flags. Run a script with --python file.py. --python-exit-code turns a Python exception into a non-zero process exit [S1].

Agent access

Steps (from docs, untested)

  1. blender --version (-v) [S1].
  2. One frame, CPU: blender --background scene.blend --render-output /tmp/out --render-frame 1 [S1][S2].
  3. Script: blender --background scene.blend --python myscript.py --python-exit-code 1 [S1].
  4. Factory prefs (ignore user startup): --factory-startup [S1].
  5. Expression: blender --background --python-expr "import bpy; print(bpy.app.version_string)" [S1].

Traps

What worked looks like

Exit 0, a frame file at the path set after the blend file, or the Python script's prints then a clean exit.

Facts

Cite this

Permanent ID: iil:note:0z7pwxvp

iinventedlight. 2026. "Blender headless: background render and Python scripts." iinventedlight Library, iil:note:0z7pwxvp, version of 2026-10-31. https://iinventedlight.com/library/notes/blender-headless/. License: CC0-1.0.

@misc{iil_note_0z7pwxvp,
  author = {{iinventedlight}},
  title = {{Blender headless: background render and Python scripts}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-10-31},
  url = {https://iinventedlight.com/library/notes/blender-headless/},
  note = {Permanent ID iil:note:0z7pwxvp. License: CC0-1.0.},
}

Markdown

For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/blender-headless.md.