4
$\begingroup$

I am currently writing a script that should render out each render layer via:

bpy.ops.render.render(layer=“InsertRenderLayerNameHere”)

and then save the resulting image. The problem is that when I do:

bpy.data.images[“Render Result”].save_render(“InsertFilePathHere”,scene=bpy.data.scene[0])

and I have the scene file format set to OpenExr Multilayer, the image still only gets saved as a normal/flat openexr file. This is probably a bug right?

The even weirder thing is that then I open a OpenExr Multilayer file in Blender and then go:

bpy.data.images[“OpenExr_Test_File.exr”].file_format 

python outputs : “’PNG”

Thanks in advance for any answers

$\endgroup$
3
  • $\begingroup$ Hello, is there any update on this ? If the question is unanswered, should I start a new one instead ? $\endgroup$ Sep 28, 2015 at 8:18
  • $\begingroup$ hi jonathan, sorry for the late answer. I think the only workaround I found at that time is to write the image to disk while rendering: bpy.ops.render.render(write_still=True). I currently don't have the time to look into it further, sorry :( $\endgroup$ Oct 3, 2015 at 14:48
  • $\begingroup$ No worries, I've found a workaround in Python as well : Use the File output Node, and addinputs if yo uneed a multilayer EXR. Adding this as a suggested answer. $\endgroup$ Oct 5, 2015 at 6:57

1 Answer 1

3
$\begingroup$

You can add a File output Node, then add as many sockets as you need in your multilayer EXR, and connect them to your renderlayer sockets node:

renderlayers_node = scene_tree.nodes.new('CompositorNodeRLayers')
outputfile_node = scene_tree.nodes.new('CompositorNodeOutputFile')
outputfile_node.format.file_format = 'OPEN_EXR_MULTILAYER'  # 'OPEN_EXR'
outputfile_node.base_path = base_path
outputfile_node.file_slots.new('Z')
scene_tree.links.new(renderlayers_node.outputs['Image'], outputfile_node.inputs['Image'])
scene_tree.links.new(renderlayers_node.outputs['Z'], outputfile_node.inputs['Z'])
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .