First of all I know that the easiest and probably the most efficient and the fastest way would be to add File Output with different inputs, but as far as it is possible I'd like to avoid writing unnecessary files on disc. For my addon I'd like to store all pixels from all render passes to numpy array and then move the results to the generated multilayer image without writing it on disc.

Pixels can be gotten from bpy.data.images['Viewer Node'].pixels, and with Python it is possible to reconnect Viewer node in Compositor to each pass and got particular pass's pixels from there. It starts to be complicated when you have not just a single View Layer but dozens of different Render Layers in Compositor, and worse - Viewer node gives only 4 channel RGBA image, while the passes may be of other types: some of them are values (depth, mist, ao), some are vectors (normals), etc.

Of course I could write a couple hundreds more lines of code to find out node.outputs[0].type for each Render Layer output, write for each type an algorithm to convert its RGBA Viewer result back to its original type and store them to array. This seems to be unnatural and weird way (comparing to something like ...nodes['Render Layers'].output[0].image.pixels) which takes additional memory, processing time and effort. But we all know those unexplainable limits in Blender's API and from time to time each of us has to do weird things. (Still hope there's more straight forward way of doing this which I've missed).

But how can I store pixels from an array to different image layers? I can generate an image in Blender and set its type to "MULTILAYER", but I haven't found any additional options like image.layers[0] appear after that. More to say, I've tried to find a path to existing Open EXR Multilayer file's different layers through API - and failed. And of course multilayer's self pixels, size, channels, resolution and other parameters are returned as 0, which is very similar to what we've got from 'Render Result' image.

To summarize.

The best and more obvious way would be if there was something like bpy.data.images['Render Result'].passes[0].pixels and the same for multilayer images.

  1. Is it true? The problem to get an access to render results in Blender is actual for almost 7 years and yet we still don't have a solution in 2020?
  2. There's no way to access/change individual multilayer image's layers' data through blender API?


This is a known feature. At the moment there is no access to multilayer images' pixels through API. But the thread is not closed, so still there is a hope this will be improved.

  • 1
    $\begingroup$ The task for the API improvements is T54272. $\endgroup$ – Robert Gützkow Mar 22 at 13:11
  • $\begingroup$ @robert-gützkow thank you! You mean, this is a good idea to leave a request there, or this is just to be in the known what is currently in work? I am still very new to all this. $\endgroup$ – Andrey Sokolov Mar 22 at 18:03
  • $\begingroup$ Adding comments with feature requests is usually frowned upon, but poking for an update is probably ok. $\endgroup$ – Robert Gützkow Mar 22 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.