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:
Not working:

