LinuxCommandLibrary

blender

Run the Blender 3D creation suite

TLDR

Render all frames of an animation in the background, without loading the UI (output is saved to /tmp)

$ blender [[-b|--background]] [path/to/file.blend] [[-a|--render-anim]]
copy

Render an animation using a specific image naming pattern, in a path relative (//) to the .blend file
$ blender [[-b|--background]] [path/to/file.blend] [[-o|--render-output]] //[render/frame_###.png] [[-a|--render-anim]]
copy

Render the 10th frame of an animation as a single image, saved to an existing directory (absolute path)
$ blender [[-b|--background]] [path/to/file.blend] [[-o|--render-output]] /[path/to/output_directory] [[-f|--render-frame]] [10]
copy

Render the second last frame in an animation as a JPEG image, saved to an existing directory (relative path)
$ blender [[-b|--background]] [path/to/file.blend] [[-o|--render-output]] //[output_directory] [[-f|--render-frame]] [JPEG] [[-f|--render-frame]] [-2]
copy

Render the animation of a specific scene, starting at frame 10 and ending at frame 500
$ blender [[-b|--background]] [path/to/file.blend] [[-S|--scene]] [scene_name] [[-s|--frame-start]] [10] [[-e|--frame-end]] [500] [[-a|--render-anim]]
copy

Render an animation at a specific resolution, by passing a Python expression
$ blender [[-b|--background]] [path/to/file.blend] --python-expr '[import bpy; bpy.data.scenes[0].render.resolution_percentage = 25]' [[-a|--render-anim]]
copy

Start an interactive Blender session in the terminal with a Python console (do import bpy after starting)
$ blender [[-b|--background]] --python-console
copy

SYNOPSIS

blender [OPTIONS] [FILE]
blender -b [FILE] -o //render/image_ -F PNG -E CYCLES -s 1 -e 250 -a
blender -b [FILE] -P script.py

PARAMETERS

-b, --background
    Run in background (no GUI). Essential for rendering without the graphical interface, especially for batch processing.

-o <path>, --render-output <path>
    Specify the output path for rendered images or animations. Path can be relative (e.g., //render/) or absolute.

-F <format>, --render-format <format>
    Set the output file format (e.g., PNG, JPEG, FFMPEG, OPEN_EXR). Affects the type of file saved.

-E <engine>, --engine <engine>
    Select the render engine to use (e.g., CYCLES, BLENDER_EEVEE, BLENDER_WORKBENCH).

-s <start_frame>, --start-frame <start_frame>
    Set the start frame number for an animation render.

-e <end_frame>, --end-frame <end_frame>
    Set the end frame number for an animation render.

-f <frame>, --frame <frame>
    Render a single specific frame number.

-a, --render-anim
    Render the full animation as defined by the start and end frames in the Blender file or overridden by -s and -e.

-P <script.py>, --python <script.py>
    Run the specified Python script within Blender's environment. Useful for automating complex tasks and data manipulation.

--version
    Print Blender version information and exit.

--help
    Display a summary of command-line options and exit.

DESCRIPTION

Blender is a professional, free, and open-source 3D computer graphics software toolset used for creating animated films, visual effects, art, 3D printed models, motion graphics, interactive 3D applications, and video games.

While primarily a graphical application, the blender command-line interface provides powerful capabilities for automation, batch processing, and integration into render farms. Users can leverage it for tasks such as opening .blend files, rendering single frames or entire animations in headless mode (without a GUI), executing Python scripts for advanced customization, and converting between various file formats. This makes blender a versatile tool not just for interactive design but also for server-side processing and continuous delivery pipelines.

CAVEATS

Command-line rendering, especially with complex scenes or high-quality settings, can be extremely resource-intensive (CPU, RAM, GPU). Ensure your system meets the necessary hardware requirements. Python scripting requires understanding Blender's specific Python API (bpy). Missing dependencies for specific render engines (e.g., CUDA or OpenCL drivers for GPU rendering) can lead to errors or fallbacks to CPU rendering.

PYTHON SCRIPTING FOR AUTOMATION

The ability to run Python scripts via the command line (using -P or --python) is one of blender's most powerful features. This allows users to automate repetitive tasks, create custom tools, perform complex data manipulation on .blend files, and integrate Blender into larger software pipelines without needing to interact with the GUI. Scripts have full access to Blender's API (bpy), enabling control over almost every aspect of a scene, object, or render setting.

HEADLESS RENDERING FOR RENDER FARMS

Running blender in background mode (-b or --background) is crucial for setting up render farms or automated rendering workflows. This allows rendering to occur on dedicated servers without the overhead of a graphical interface, making it efficient for batch rendering large numbers of frames or complex animations across multiple machines. It's a cornerstone for professional animation studios and VFX houses utilizing Blender.

HISTORY

Blender was initially developed as an in-house application by the Dutch animation studio NeoGeo in 1994, with the primary author being Ton Roosendaal. In 1998, it was released to the public as freeware. When NeoGeo went bankrupt in 2002, the source code was released under the GNU General Public License (GPL) following a successful crowdfunding campaign. Since then, it has been continuously developed by the Blender Foundation and a global community, evolving into one of the most comprehensive and widely-used open-source 3D software packages.

SEE ALSO

xdg-open(1), ffmpeg(1), python(1), convert(1) (ImageMagick)

Copied to clipboard