EXR Metadata (Layers)

How do I get the layers inside an EXR file?

We are working on a project with multiple “scenes” (blend files), each scene has different characters distributed on layers and we are rendering to EXR files.

What I want to do is a quick composition combining all the layers.

I can add an Image node and open the EXR, and from there I can select the layer I want to show:


With Python I can get the current layer in that node:

>>>bpy.data.scenes['Scene'].node_tree.nodes['Image'].layer
'Background'

And I can select another layer

bpy.data.scenes['Scene'].node_tree.nodes['Image'].layer = "Character1"

But I need to find out how many there are and the name of each layer since each EXR is different.

Is there a way to get that information?

Can you provide a sample EXR file? I couldn’t find a working multi-layer file so far for testing.

I cannot upload EXR files here but with this .blend you can generate a test EXR.

test_exr.blend (493 KB)

Hope it helps.

The output file should be test0001.exr. And with this other blend

view_exr.blend (483 KB)

you can view a quick composition, just put the blend in the same folder where the EXR is generated. Open the blend (the first node should be selected) and click “reload” in the properties panel.

Thanks.

There doesn’t seem to be a way to determine the number of layers, looks all pretty hardcoded in C.

Damn… that’s too bad. I’ll keep on looking for a precompiled OpenEXR module.

Thanks.