0

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

Expected:

enter image description here

Not working:

enter image description here

Tadas P42
  • 21
  • 3
  • 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. https://blender.stackexchange.com/q/556/60486 – Markus von Broady Dec 20 '23 at 16:21
  • 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? – Tadas P42 Dec 21 '23 at 09:06

0 Answers0