EdgeOutline is a tool to create the outline of the alpha of the main input. I found myself several times using this technique or a similar one, so I decided to make it into a tool to allow me to be faster and more efficient.

You can select the way you want to detect your edge and then play with the rest of the values to get what you want. You can also connect a mask to apply it just to one area, or use the Enable Remove button to get an extra input that lets you cut off an area of the final result.
Expand EdgeOutline
Group {
name EdgeOutline1
onCreate "\nif nuke.thisNode()\['f_created'].getValue()==True:\n\tnuke.thisNode()\['f_created'].setValue(False)\n\tnuke.thisNode().showControlPanel()"
knobChanged "\nif nuke.thisKnob().name() == \"erode_type\": \n\tif nuke.thisKnob().getValue() == 0:\n \tnuke.thisNode().knob('erode_size').setVisible(False)\n \tnuke.thisNode().knob('dilate_size').setVisible(True)\n\tif nuke.thisKnob().getValue() == 1:\n \tnuke.thisNode().knob('dilate_size').setVisible(False)\n \tnuke.thisNode().knob('erode_size').setVisible(True)\n"
tile_color 0xe5804bff
selected true
xpos 552
ypos 45
addUserKnob {20 User}
addUserKnob {26 author -STARTLINE +INVISIBLE T "Javier Nieto Moncó 2020"}
addUserKnob {41 edgedetector l "edge detector" T EdgeDetect9.edgedetector}
addUserKnob {41 threshold l Threshold T EdgeDetect9.threshold}
addUserKnob {68 erode_type l "Erode Type" t "Choose the erode type you want to use:\n<b> Dilate</b> will use an Erode (fast) node.\n<b> Erode Blur</b> will use an Erode (blur) node." M {Dilate "Erode Blur" "" "" "" "" ""}}
addUserKnob {7 dilate_size l Size t "This knob controls the size of the erode." R -20 20}
dilate_size 2
addUserKnob {7 erode_size l Size t "This knob controls the size of the erode." +HIDDEN R -20 20}
addUserKnob {41 blackpoint l Blackpoint T Grade77.blackpoint}
addUserKnob {41 whitepoint l Whitepoint T Grade77.whitepoint}
addUserKnob {7 edgeBlur_size l "Edge Blur" t "Amount of blur applied to the edge." R 0 100}
edgeBlur_size 3
addUserKnob {7 blur_size l Blur t "This knob controls the general blur applied to the input." R 0 100}
blur_size 25
addUserKnob {26 ""}
addUserKnob {7 mix}
mix 1
addUserKnob {22 removeEnable l "Enable Remove" t "Enables a new input that you can use to cut a portion of the node's result out.\n\nUseful when you just want the effect on the outside for example. You use the matte as this input and it will cut that shape out of the result." T "nuke.thisNode().knob('removeDisable').setVisible(True)\nnuke.thisNode().knob('removeEnable').setVisible(False)\n\n\n\ndef deselectAll():\n for node in nuke.allNodes():\n node\['selected'].setValue(False)\n\ndeselectAll()\n\nnuke.nodes.Input(name='remove', xpos=146.0, ypos=24.0, selected=True)\nnewInput = nuke.selectedNode()\n\ndeselectAll()\n\nfor node in nuke.allNodes():\n if node\['name'].getValue() == 'REMOVE_REF_DOT':\n node\['selected'].setValue(True)\nnuke.selectedNode().setInput(0, newInput)\n\ndeselectAll()\n\nfor node in nuke.allNodes():\n if node\['name'].getValue() == 'RemoveStencil':\n node\['disable'].setValue(False)" +STARTLINE}
addUserKnob {22 removeDisable l "Disable Remove" t "Disables the remove input." -STARTLINE +HIDDEN T "nuke.thisNode().knob('removeEnable').setVisible(True)\nnuke.thisNode().knob('removeDisable').setVisible(False)\n\nfor node in nuke.allNodes():\n node\['selected'].setValue(False)\n if node.Class() == 'Input':\n node\['selected'].setValue(True)\n for inputs in nuke.selectedNodes():\n if not inputs\['name'].getValue() == 'remove':\n inputs\['selected'].setValue(False)\n\n#xPos = nuke.selectedNode()\['xpos'].getValue()\n#yPos = nuke.selectedNode()\['ypos'].getValue()\n\nnukescripts.node_delete(popupOnError=True)\n\nfor node in nuke.allNodes():\n if node\['name'].getValue() == 'RemoveStencil':\n node\['disable'].setValue(True)"}
addUserKnob {6 mask -STARTLINE}
addUserKnob {6 f_created l "First Created?" +INVISIBLE +STARTLINE}
f_created true
}
Input {
inputs 0
name mask
xpos -403
ypos 217
number 1
}
Dot {
name Dot509
xpos -369
ypos 290
}
Dot {
inputs 0
name REMOVE_REF_DOT
xpos 180
ypos 164
}
Input {
inputs 0
name Input
xpos -76
ypos -317
}
Shuffle {
in alpha
name Shuffle151
label "\[value in]"
xpos -76
ypos -277
}
EdgeDetectWrapper {
name EdgeDetect9
xpos -76
ypos -241
}
set N57512400 [stack 0]
Dot {
name Dot1
xpos -227
ypos -232
}
Erode {
channels rgba
size {{parent.erode_size}}
name Erode51
xpos -261
ypos -97
}
push $N57512400
Dilate {
channels rgba
size {{parent.dilate_size}}
name Dilate10
xpos -76
ypos -161
}
Switch {
inputs 2
which {{parent.erode_type}}
name Switch1
xpos -76
ypos -97
}
Grade {
black_clamp false
maskChannelInput -rgba.alpha
unpremult -rgba.alpha
name Grade77
xpos -76
ypos -35
}
Clamp {
maskChannelInput -rgba.alpha
unpremult -rgba.alpha
name Clamp18
xpos -76
ypos -11
}
EdgeBlur {
channels rgba
size {{parent.edgeBlur_size}}
name EdgeBlur21
xpos -76
ypos 25
}
Blur {
channels rgba
size {{parent.blur_size}}
maskChannelInput -rgba.alpha
name Blur148
xpos -76
ypos 61
}
Merge2 {
inputs 2
operation stencil
maskChannelInput -rgba.alpha
name RemoveStencil
xpos -76
ypos 161
disable true
}
Merge2 {
inputs 2
operation mask
maskChannelInput -rgba.alpha
name Merge252
xpos -76
ypos 287
disable {{!parent.mask}}
}
Shuffle {
in alpha
name Shuffle152
label "\[value in]"
xpos -76
ypos 345
}
Multiply {
value {{parent.mix}}
maskChannelInput -rgba.alpha
unpremult -rgba.alpha
name Multiply44
label "\[value value]"
xpos -76
ypos 381
}
Output {
name Output1
xpos -76
ypos 497
}
end_group