# Get image pixels from multiple viewer nodes

For Blender 2.81 and Cycles render.

I want to access all of the following data passes from a Python script:

• Z
• Normal
• Vector
• Object Index

Therefore, I created three Viewer Nodes with different names. See the following image:

The viewer node on the top is getting both the Z and the Normal passes. The one in the middle is getting the Vector, and the one in the bottom the IndexOB.

Now my issue is that when I use the following code pixels = bpy.data.images['Viewer Node'].pixels, I can only access the data from the top Viewer Node (we only get the pixel data of the node that was selected from the user interface).

Is there a way that I can specify through the NameId of the Viewer Node which pixels data do I want to access?

I tried selecting and activating the different nodes through a script but apparently the data does not get automatically updated. The viewer node has to be manually clicked to make it visually active which then updates the images['Viewer Node'] data that we want to access. I found more info about this "known limitation" here.

• similar question: blender.stackexchange.com/questions/32640/… – João Cartucho Jan 20 at 21:55
• Can you try to use one Viewer with Switch nodes or connect sockets via python for every case? – Serge L Jan 24 at 15:41
• Tried switch nodes and the issue is the same. To connect via python for every case I would need to render multiple times. I want to render only once. – João Cartucho Jan 24 at 15:55
• How exactly would you want to post the data? – Nate_Sycro27 Jan 24 at 18:58
• Is there any reason why you can't use the File Output nodes? – WhatAMesh Jan 29 at 18:50