How to hide TreeExpanderButton while making Image of the tree

I have an Incremental Tree which I export as an image as:
var imgBlob = myDiagram.makeImageData({ scale: 1, maxSize: new go.Size(4000,4000), background: 'white', type: "image/png" });

This generates image as:

I have defined by expander button as :
$("TreeExpanderButton", { width: 20, height: 20, alignment: go.Spot.TopRight, alignmentFocus: go.Spot.TopRight })

So, how can I hide this while exporting the image?

Give the button a name, for example: name: "TEB".

Then before calling makeImage or makeSvg, do:

myDiagram.nodes.each(function(n) { n.findObject("TEB").opacity = 0.0; });

Afterwards, change their opacity back to 1.0. Oh, I suppose if you might have any Nodes without that button, you should check that findObject returned non-null.

Thanks Walter, it worked perfectly!