Sub topic 8
Rendering and saving a still image
This chapter assumes you can open the Properties editor and switch between its tabs. It also assumes your scene has a camera, a light, and at least one visible object. You should have chosen a render engine and a sample count in earlier chapters. Here you will run the render, find the result, and write it to disk by hand, from a script, and from the command line.
What happens when you press F12
Rendering a still has two separate stages, and mixing them up causes most "where did my image go?" problems.
- Render. Blender evaluates the scene at the current frame, looks through the active camera, and computes pixels with the selected engine. The pixels go into a temporary buffer called the Render Result.
- Save. The Render Result is only kept in memory. Nothing reaches disk until you save it, or until a script or command-line flag tells Blender to write it.
Rendering from the interface
Use Render > Render Image or press F12. Blender opens a render window, or an Image Editor in the layout you have set, and shows tiles or progressive refinement depending on the engine. The result is drawn into the Render Result slot.
Before you start a long render, check these items:
- The camera in Scene properties > Camera is the one you want. The scene can contain many cameras, but only this one is rendered.
- The frame you want is the current frame in the Timeline. A still render uses the current frame, so animated objects appear in their pose at that frame.
- Resolution and percentage in Output properties > Format are what you intend. A leftover 25% from a draft render is a common cause of a small, blurry final image.
Press Esc in the render window to cancel. Cancelling keeps whatever was already computed, which is useful for judging a Cycles render, but that partial image is not a finished one.
Saving the result from the Image Editor
With the Render Result visible, choose Image > Save As (Shift+Alt+S). The file browser has its own format panel on the side. Three details matter here:
- The format panel in this dialog is a copy of the scene's output format. Changing it changes only this save, unless you change it back in the Output properties.
- Save As writes the image you see. Save a Copy does the same and leaves the Render Result as the current image. Both are fine for a render.
- Formats differ in what they can store. PNG and OpenEXR keep an alpha channel if the render has one. JPEG does not. Setting Color to RGBA while saving a JPEG silently drops the transparency, so check the format before you blame the render.
The Render Result is lost when you close Blender or start another render, unless you saved it first. For a render you might want to compare later, use the slot selector in the Image Editor header. Blender keeps a few results in separate slots, so a new render does not overwrite the one you want to keep.
Where the file goes: the output path
The path in Output properties > Output controls where automated saves go. It does not affect Save As, which always asks you.
Blender uses two path styles:
| Path | Meaning |
|---|---|
| `//renders/still.png` | Relative to the folder that contains the saved `.blend` file |
| `/home/user/renders/still.png` | Absolute path, independent of the `.blend` file |
The // prefix is Blender's own relative marker. It only makes sense once the .blend file has been saved. In an unsaved file there is no folder to be relative to, and the render may land in an unexpected location, such as a temporary directory. Save your project first.
In the interface, the output path matters for animations, where Blender writes the files itself. For a still, you will most often meet the path through a script or the command line.
Rendering and saving from Python
The bpy module lets you set every option and trigger the render. This script checks that a camera exists, sets the engine and output, then renders and writes the file:
import bpy
scene = bpy.context.scene
if scene.camera is None:
raise RuntimeError("The scene has no active camera. Set scene.camera first.")
scene.render.engine = 'CYCLES'
scene.cycles.samples = 128
scene.cycles.use_denoising = True
scene.render.resolution_x = 1920
scene.render.resolution_y = 1080
scene.render.resolution_percentage = 100
scene.render.image_settings.file_format = 'PNG'
scene.render.filepath = '//renders/still.png'
bpy.ops.render.render(write_still=True)
print("Saved to", bpy.path.abspath(scene.render.filepath))The key argument is write_still=True. Without it, bpy.ops.render.render() renders into the buffer and writes nothing. That is how scripts end up producing no file even though the render finished. The call renders the current frame from the active camera, so set scene.frame_set(n) first if you need a specific frame.
You can also pass layer and scene names to the operator to render a non-active scene. When you do, set that scene's options, not those of bpy.context.scene.
Rendering from the command line
Background mode (-b) starts Blender without a window. It is the usual way to render on a server or inside a build script.
blender -b scene.blend -o //renders/still_#### -F PNG -x 1 -f 1Each flag has a specific job:
-b scene.blendloads the file without a user interface.-o //renders/still_####sets the output path. The####is replaced by the frame number, padded to four digits, so frame 1 becomesstill_0001.-F PNGsets the output format.-x 1turns on adding the file extension. Without it, the file is namedstill_0001with no.png.-f 1renders frame 1 as a single image and then exits.
If you leave out the ####, Blender still adds the frame number to the file name and pads it to four digits. For one-off stills, that is rarely what you want, so write the number pattern yourself or confirm the name after the first run.
Common problems with a first still
| Symptom | Likely cause | Fix |
|---|---|---|
| Image is black or empty | No active camera, or the camera faces away from the objects | Set the scene camera and look through it with Numpad 0 |
| Script finishes but no file appears | `write_still` is missing or false | Pass `write_still=True` |
| File is in an unexpected folder | The `.blend` file is unsaved, so `//` has no base folder | Save the project, or use an absolute path |
| Output is smaller than expected | Resolution percentage is below 100 | Set it to 100 |
| Result has no transparency | Format does not support alpha, or Film > Transparent is off | Use PNG with RGBA, and enable Transparent |
| File name has no extension | Command line missing `-x 1`, or File Extensions is off | Add `-x 1`, or enable the option |
Exercise
A colleague runs a script that sets scene.render.filepath = '//renders/shot.png' and then calls bpy.ops.render.render(). The render finishes, but there is no shot.png. Give the cause and the fix. Then explain why blender -b scene.blend -f 1 -o //out/img_#### -F PNG -x 1 could write a file in the wrong place or format.
Show answer
The call does not pass write_still=True, so Blender renders into the Render Result buffer and never writes it. Change the call to bpy.ops.render.render(write_still=True). For the command, Blender reads arguments from left to right, so -f 1 runs the render before -o, -F, and -x are applied. The render uses the settings saved in the .blend file. Put -o //out/img_#### -F PNG -x 1 before -f 1.