Center align picture inside a node

In my application I have a GoJS diagram editor and I am trying to create a node and inside a node I am adding a picture. I need to center align the picture. Is there anyway I can do this?
Node Tepmplate code,

diagram.nodeTemplateMap.add("memoPicture",
	GO(go.Node, "Spot",	
		new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
			GO(go.Panel, "Horizontal",
				GO(go.Picture,
				{
					name: "Picture",
					maxSize: new go.Size(250, 250),
					margin: new go.Margin(5, 5, 5, 5),
				},
				new go.Binding("source", "source"))			            
		)  
	) 
);

Code to add image is as below,

var location = "5 5";
var textNode =  $scope.diagramOptions.findNodeForKey("1");
	if (textNode !== null && textNode !== undefined) {
		var actBounds = textNode.actualBounds;
		location = "5" + (10 + actBounds.height);
	}
$scope.model.startTransaction("addPicture");
$scope.model.addNodeData({ key : "2", category:"memoPicture",  source:imageSource, loc: location, type: "editorImage" });			
$scope.model.commitTransaction("addPicture");

Your Picture is inside a “Horizontal” Panel, but there is only one element in that Panel. So that Panel is serving no use – just delete it.

You only have one element inside your “Spot” Panel. Again this is undesirable – every “Spot” Panel should at least have a main element as its first element, with all other elements positioned relative to that main element.

More seriously, I’m finding it very hard to read your code. Please format and indent it properly. Code Formatting

Thanks Walter. this is working,