Sub topic 2
Choosing an Image File Format
This chapter assumes you can open the Output Properties tab, that your scene has a camera and at least one light, and that you can run a short Python script in Blender's Scripting workspace. It covers the file format, where output goes, how frame numbers are written, and how to render one still image.
Choosing an image file format
The file format sets how Blender stores pixels on disk. Choose the format by what you need from the image.
| Format | Compression | Transparency (alpha) | Typical use |
|---|---|---|---|
| PNG | Lossless | Yes | Stills and frames for editing |
| JPEG | Lossy | No | Small previews where exact pixels do not matter |
| OpenEXR | Lossless | Yes | High dynamic range data for compositing |
Use PNG for most work. It keeps every pixel exactly and supports 8 or 16 bit color.
Output paths and frame-number padding
The path lives in scene.render.filepath. A path that starts with // is relative to the folder that holds the .blend file. When you render an animation, Blender writes a frame number into the file name. A run of # characters marks where that number goes, and the count of # sets the padding. For example, frame_#### produces frame_0001. Padding keeps files sorted in order in file browsers and video tools.
> Blender overwrites existing files with the same name without asking. Render to a new folder or add a version suffix before you re-render.
Note: that warning is a callout, so it is written below.
Rendering and saving a still image
The following script sets the engine, resolution, and format, then renders the active camera and saves the result.
import bpy
scene = bpy.context.scene
scene.render.engine = 'CYCLES'
scene.cycles.samples = 128
scene.render.resolution_x = 1920
scene.render.resolution_y = 1080
scene.render.resolution_percentage = 100
scene.render.image_settings.file_format = 'PNG'
scene.render.image_settings.color_depth = '8'
scene.render.filepath = '//renders/still'
bpy.ops.render.render(write_still=True)The write_still=True argument saves the image to filepath. Without it, the result stays in the Render Result window only. Make sure the renders folder exists before you run the script.
Setting the frame range and frame rate
The frame range uses frame_start and frame_end, and both frames are included. A range of 1 to 48 at 24 fps gives 48 frames, which is 2 seconds of footage.
import bpy
scene = bpy.context.scene
scene.frame_start = 1
scene.frame_end = 48
scene.render.fps = 24Exercise
A scene has framestart = 1, frameend = 96, and fps = 24. How many frames render, and how long is the clip?
Show answer
96 frames render, because the end frame is included. At 24 fps, the clip lasts 4 seconds.