Distance node
This documentation is for version 1.0 of Distance (eu.cimg.Distance).
Description
Compute at each pixel the distance to pixels that have a value of zero.
The distance is normalized with respect to the largest image dimension, so that it is between 0 and 1.
Optionally, a signed distance to the frontier between zero and nonzero values can be computed.
The distance transform can then be thresholded using the Threshold effect, or transformed using the ColorLookup effect, in order to generate a mask for another effect.
See alse https://en.wikipedia.org/wiki/Distance_transform
Uses the ‘distance’ function from the CImg library.
CImg is a free, opensource library distributed under the CeCILLC (close to the GNU LGPL) or CeCILL (compatible with the GNU GPL) licenses. It can be used in commercial applications (see http://cimg.eu).
Inputs
Input 
Description 
Optional 

Source 
No 

Mask 
Yes 
Controls
Parameter / script name 
Type 
Default 
Function 

Metric / 
Choice 
Euclidean 
Type of metric.
Chebyshev (chebyshev): max(abs(xxborder),abs(yyborder))
Manhattan (manhattan): abs(xxborder) + abs(yyborder)
Euclidean (euclidean): sqrt(sqr(xxborder) + sqr(yyborder))

Signed Distance / 
Boolean 
Off 
Instead of computing the distance to pixels with a value of zero, compute the signed distance to the contour between zero and nonzero pixels. On output, nonzerovalued pixels have a positive signed distance, zerovalued pixels have a negative signed distance. 
(Un)premult / 
Boolean 
Off 
Divide the image by the alpha channel before processing, and remultiply it afterwards. Use if the input images are premultiplied. 
Invert Mask / 
Boolean 
Off 
When checked, the effect is fully applied where the mask is 0. 
Mix / 
Double 
1 
Mix factor between the original and the transformed image. 