How to connect two nodes using python


(Ishaan Sathe) #1

I want to merge images using python . I have merged images with merge node but to display that merged file output i need to connect merged node with viewer node . My code is given below

app = natron.getGuiInstance(0)
read = app.createNode(“net.sf.openfx.MergePlugin”)
reader = app.createReader(“C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg”)
reader1 = app .createReader(“C:\Users\Public\Pictures\Sample Pictures\Tulips.jpg”)
reader2 = app.createReader(“C:\Users\Public\Pictures\Sample Pictures\Hydrangeas.jpg”)
view = app.createNode( “fr.inria.built-in.Viewer”)
#Connect the write node to the blur

read.connectInput(1,reader)
read.connectInput(0,reader1)
read.connectInput(3,reader2)
read.connectNode(4,view)

My question is how to connect the merged output node to the viewer node ??


(Mikhail) #2

from NatronEngine import *
from NatronGui import *

app = natron.getGuiInstance(0)
merge = app.createNode(‘net.sf.openfx.MergePlugin’)
reader = app.createReader(‘C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg’)
reader1 = app .createReader(‘C:\Users\Public\Pictures\Sample Pictures\Tulips.jpg’)
reader2 = app.createReader(‘C:\Users\Public\Pictures\Sample Pictures\Hydrangeas.jpg’)
view = app.createNode(‘fr.inria.built-in.Viewer’)

#Connect the write node to the blur
merge.connectInput(1,reader)
merge.connectInput(0,reader1)
merge.connectInput(3,reader2)
view.connectInput(0,merge)