# Tutorial Double Border

## The Double Border Node Graph project

This project applies a two color border to an image and it contains all the necessary nodes to be reused in other projects:

• The Attributes node defines 3 attributes: The size of the borders and the colors of the two borders.

• The Image IO inside the Inputs Node Frame defines the input of the reusable node.

• The Image IO inside the Outputs Node Frame defines the output of the reusable node.

• The nodes inside the Body of the Algorithm Node Frame define the body of the custom node: The Border nodes. Their exposed attributes are fed by the Attributes Node. Left Click on node to expose its attributes.

This project is saved in a file Double_Border.pxf.

## Reusing the Double Border node graph

1. Create a new empty project. File > New > Empty Project
2. Create an Node Graph node .
3. Click the Path button and load the Double_Border.pxf project. Double click the node to reactivate it and display all its attribute, inputs and outputs.
4. Drag and drop an image into the project to create a Reader node.
5. Connect [Reader › image] to [image › Double_Border].
6. Set the size and color of the border.

This Double_Border node applies the two borders to the image with the border size and colors defined in the attributes of the Node Graph node.

You will now modify the Double_Border.pxf project to add more borders to the image using multiple loops. Each border will be one size larger than the previous border.

2. Create a new Loop Iterations node. This node has two number outputs, the current iteration and the number of iterations. The attributes of this node can be used to test the behavior of the node graph at different iterations.
3. Create a new Number Multiply node.
4. Connect [Loop Iterations › iteration] to [number_a › Number Multiply]. The Number Multiply node will multiply the size of the border by the current iteration.
5. Connect [Number Multiply › number] to [size › Border].
6. Connect [Number Multiply › number] to [size › Border].
7. Resize the Node Frames and add a new Node Frame for the Loop Iterations node.
8. Modify the Loop Iterations Iteration attribute to see how the border size changes on each iteration.
9. Save this project as DoubleBorderLoop.pxf.

## Testing the Double Border Loop Project

In a new project create a new Reader node with an image and a new Node Graph node. Load the DoubleBorderLoop.pxf project in this node.

Increase the number of iterations in the DoubleBorderLoop node.

There is something wrong. The DoubleBorderLoop node is not applying multiple borders, instead it is creating a larger border.

This happens because by default the Node Graph node applies the same node graph to the same input image, and each iteration makes the border larger.

To fix the effect you need to tell the Node Graph node that the new border has to be applied to image generated in the previous loop.

## Fixing the Double Border Loop Project

1. Activate the input Image IO node and rename it image.
2. Activate the output Image IO node and rename it image.

## Testing the Double Border Loop Project

In a new project create a new Reader node with an image and a new Node Graph node. Load the DoubleBorderLoop.pxf project in this node.

Increase the number of iterations in the DoubleBorderLoop node.

## Creating a Custom Node from the Double Border project

Now that you have a node graph project that can be reused, you can create a new custom node and use it in PixaFlux as any other node.

Note: If you installed PixaFlux in the Program Files directory you'll need Administrator access to add the new files to the PixaFlux program directory. This tutorial assumes that PixaFlux was installed in:

``````c:\Program Files\PixaFlux
``````

### Custom Node Directory

Create a new DoubleBorder directory in (PixaFlux)/Resources/Nodes:

``````C:\Program Files\PixaFlux\Resources\Nodes\DoubleBorder
``````

### info.txt

Create a new info.txt file in the DoubleBorder directory:

``````C:\Program Files\PixaFlux\Resources\Nodes\DoubleBorder\info.txt
``````

Visit Online GUID Generator and generate a new guid. For example:

``````6c538cf4-abaf-473e-9ece-e54816b7eb8e
``````

Leave only two 8 hex digit strings:

``````6c538cf4 abaf473e
``````

``````0x6c538cf4 0xabaf473e
``````

And copy this hexadecimal identifier to info.txt as the Type:

``````Type: 0x6c538cf4 0xabaf473e
``````

Add the project file, node name and node group to the file.

``````Type: 0x6c538cf4 0xabaf473e
Project: Double_Border.pxf
Name: Double Border
Group: Layout
``````

### Project file

Copy the Double_Border.pxf file to the Resources\Nodes directory.

``````C:\Program Files\PixaFlux\Resources\Nodes\DoubleBorder\Double_Border.pxf
``````

### Icons

Create the new icons for the Double Border node and save them to the Resources\Nodes directory, or copy these ones:

Nodes Menu icon. 24 x 24 Pixels:

Node Graph icon. 12 x 12 Pixels:

This are the final directory contents:

Now restart PixaFlux and look for the new Double Border node in the Layout node group:

Create a new Double Border node and connect it to the output of an image node.

Edit the attributes.