1

Is there a way to add extra information to the filename that is created by Blender? For example, if I'm rendering images of an animation, is there a way to have Blender automatically add something like sample size to the file name it creates? Something like %samp?

I'm trying to end up with something like

C:\Blender\rendered\images\my_animation_00001-2000.jpg

Where 2000 is the sample size that was used for that particular image.

1 Answers1

2

You can add an application handler to be run before rendering that sets the output filename with the desired information. You can use python's string format to fill in the filename from a template string.

import bpy

def set_filepath(scn):
    scn.render.filepath = '//renders/animation_{0:04}-{1}.jpg'.format(
            scn.frame_current, scn.cycles.samples)

bpy.app.handlers.render_pre.append(set_filepath)

By pasting this into a text block in blender and adjusting the filename for the file, it can then be setup to run when the blend file is opened so that it will always be available when using the file.

Note that the handler will set the filename, that means you adjust the filename in the script - not in the render settings.

sambler
  • 55,387
  • 3
  • 59
  • 192