How to show render-stamp for arbitrary values?

Is it possible to take arbitrary properties and display them in the render stamp as some other software do.

(Click the image for larger version)

While Blender has no build-in support for this feature. You can do this using Python:

Add a script into your file, call it stamp_init.py (for example).

• Press Run Script (only need to do once)
• Enable the Register option in the text editor (so it runs automatically)

Here is a sample script.

import bpy

def stamp_set(scene):
note =    "Samples: "         + str(scene.cycles.samples)
note += ", Version: "         + bpy.app.version_string
scene.render.stamp_note_text = note

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


To add more settings you can find the data-paths to them by right clicking and selecting Copy Data-Path.

Global Stamp (applies to any file you render)

Having to define a script in every-file could be tedious, if you want to use these extra stamp options in all your files, you can make this a persistent handler.

If you want to have the same stamp notes apply to all your renders (where the Note is enabled). You can add the same script into your startup file and

@bpy.app.handlers.persistent
def stamp_set(scene):
.... same as before ...


String Formatting (further reading if you're new to Python)

Python has some clever ways you can format strings, see Python docs.

This uses the format method which some people may prefer.

def stamp_set(scene):
scene.render.stamp_note_text = \
samples=scene.cycles.samples,
ver=bpy.app.version_string,
)


New Lines

As of 2.77 the note will be wrapped onto new lines, you can also add in explicit \n newline characters to format the text yourself.

Floating point numbers

A lot could be written on this, just a quick hint, if you have unwanted precision removed, eg:2.514000002324 displayed as 2.51, there are a few ways to go about it.

• If you used "Text " + str(some.number) you can use round, eg:
"Text " + str(round(some.number, 2))
• If you use the format() method you can replace:
{myvar} with {myvar:.2f}.

For more details see https://stackoverflow.com/a/455634/432509

• Thanks for the information! Is it possible to reduce the amount of digits for example Aperture Size (scene.camera.data.cycles.aperture_size) string returns? - Because number 0.55 in the DOF panel returns 0.5499997735023499 – Manu Järvinen Mar 24 '15 at 16:31
• Added hint on reducing excess precision. – ideasman42 Mar 24 '15 at 17:39
• Is there a way to do this for values that change over time? For instance, the Lens stamp setting don't update when I change the focal length of the camera. What if I wanted to have a custom note that includes the camera's focal length and change it over time? Would that be possible? – Abdelrahman Said Apr 21 '20 at 16:46
• Have a look at the different handlers, after changing the frame might be a good time to run this. – ideasman42 Apr 27 '20 at 2:32

I know this is an old post, but I found out that in newer versions of Blender you can do exactly that.

In the Output Properties tab you can burn the metadata into your output image, using the Burn into image tick.

Maybe this could help someone looking for an answer.

For Blender 2.8+

Note that the aforementioned solutions do not seem to work in newer versions of Blender (I'm using 2.92.0, but I imagine the changes are from 2.8+).

Herewith a working solution:

import bpy

cycles = bpy.context.scene.cycles
view_settings = bpy.context.scene.view_settings

def stamp_set(scene):
note = "-------------\nCustom data\n-------------"
note += "\nSamples: "         + str(cycles.aa_samples)
note += "\nLook: "            + str(view_settings.look)
note += "\nExposure: "        + str(round(view_settings.exposure, 2))

scene.render.stamp_note_text = note

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



This solution:

3. Allows you to add new lines of data just by duplicating any of the note += ...  lines