Is it possible to create a custom compositor node using python? I'd like to be create the following node:

  1. Input sockets for Image and Z render results
  2. Load the image into numpy arrays
  3. Manipulate the numpy arrays in various ways
  4. Output socket for resulting image.

I've been able to create a new node type and register it the with the CompositorNodeTree, but it doesn't actually do anything. Is there a method I can implement (e.g. process or something) that can trigger the node process the image?

  • $\begingroup$ I`m also looking for option to build simple node that input chosen object transform for further post process in the compositor. OSL or other custom shader solution for the compositor would be nice. $\endgroup$
    – barakooda
    Commented Jan 16, 2022 at 13:27

3 Answers 3


While it is possible to define a pynode that can be added to existing node trees, they are considered unsupported and have limited functionality - mostly they don't get an event to automatically update. I don't think anything has changed since this previous answer.

The two main pynode projects are animation nodes and sverchok - both of these projects have implemented bpy.app.handlers that trigger an update of their node trees for various events. You will need to experiment to see if you are able to get some results using one of the render related handlers to update your node, but I don't think that any of the handlers fall between rendering and compositing.

Depending on your needs, you may be able to use a script that renders a frame, updates your node to get the result and then save the render result or viewer node output.

You may also want to try manipulating the render after it is completed instead of during compositing.

img = bpy.data.images['Viewer Node']
w = img.size[0]
h = img.size[1]
arr = np.array(img.pixels[:])
arr = arr.reshape((w,h,4))
  • $\begingroup$ Is it possible to add existing nodes to a custom pynode tree? For example, use a cloud texture output? $\endgroup$
    – VSB
    Commented Nov 27, 2018 at 21:44
  • 1
    $\begingroup$ @VSB no. But you can access the same algorithm and use it in your nodes. You will find it in mathutils.noise $\endgroup$
    – sambler
    Commented Nov 28, 2018 at 6:08

Not through python, no. Since Blender is open source you could always code a custom node like the built-in ones and recompile Blender itself. But there's no functionality for adding new compositing nodes at runtime through plugins or scripting or anything like that.

The node you created (and any nodes created via Python) are merely UI elements. They don't actually process data, they are visual representations of some other thing that will do the processing. The python nodes API is meant primarily to allow addons to add their own node editor pages for whatever functionality they need to represent to the user with nodes. Due to the way the API works it's also possible to use it to make custom nodes show up in the compositor or BI/Cycles shader trees. There is no way to supply the actual "business end" of such a node though.


Someone has compiled a version that would allow you to write your own Python scripts to process images in the compositor without recompiling:


I find it really useful. However, the number of input/output nodes appear to be fixed. I would really like to see this feature in the official release.


You must log in to answer this question.

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