I'm struggling with passing of image out of the custom node. Not sure where I need to put image for viewer to take it or how to pass it down. Tried multiple approaches, all of them failed.

Node source code:

class ImageModifyNode(bpy.types.CompositorNodeImage):
"""A custom node"""

bl_idname = "ImageModifyNode"
bl_label = "Modify image"
bl_description = "Modify image by changing colors to the ones which are closest to the provided"

show_preview = True
view = "ALL"
image = None

def init(self, context):
    self.inputs.new("NodeSocketImage", "Image")
    self.inputs.new("NodeSocketColor", "Color 1")
    self.inputs.new("NodeSocketColor", "Color 2")

    self.outputs.new("NodeSocketImage", "Image")

def update(self):
    in_socket_image = self.inputs.get("Image")
    out_socket_image = self.outputs.get("Image")

    if in_socket_image.is_linked:
        linked_image = in_socket_image.links[0].from_socket.node.image

        out_socket_image.image = linked_image
        self.image = linked_image


enter image description here

Not working:

enter image description here

  • $\begingroup$ You can't make custom nodes like that, not in Python. I Think Animation Nodes (not Geometry Nodes) allow for custom Python nodes, and that's it. blender.stackexchange.com/q/556/60486 $\endgroup$ Commented Dec 20, 2023 at 16:21
  • $\begingroup$ Just to clarify, this is not geometry but compositor nodes. The use case - we need to take the image modify and return it. We have 2/3 of this completed. The problem with displaying the image in the viewer. That is not possible? $\endgroup$
    – Tadas P42
    Commented Dec 21, 2023 at 9:06


You must log in to answer this question.

Browse other questions tagged .