EdgeExtend node
This documentation is for version 4.0 of EdgeExtend (eu.cimg.EdgeExtend).
Description
Fill a matte (i.e. a nonopaque color image with an alpha channel) by extending the edges of the matte. This effect does nothing an an opaque image.
If the input matte comes from a keyer, the alpha channel of the matte should be first eroded by a small amount to remove pixels containing mixed foreground/background colors. If not, these mixed colors may be extended instead of the pure foreground colors.
The filling process works by iteratively blurring the image, and merging the nonblurred image over the image to get to the next iteration. There are exactly ‘Slices’ such operations. The blur size at each iteration is linearly increasing.
‘Size’ is thus the total size of the edge extension, and ‘Slices’ is an indicator of the precision: the more slices there are, the sharper is the final image near the original edges.
Optionally, the image can be multiplied by the alpha channel on input (premultiplied), and divided by the alpha channel on output (unpremultiplied), so that if RGB contain an image and Alpha contains a mask, the output is an image where the RGB is smeared from the nonzero areas of the mask to the zero areas of the same mask.
The ‘Size’ parameter gives the size of the largest blur kernel, ‘Count’ gives the number of blur kernels, and ‘Ratio’ gives the ratio between consecutive blur kernel sizes. The size of the smallest blur kernel is thus ‘Size’/‘Ratio’^(‘Count’1)
To get the classical single unpremultblurpremult, use ‘Count’=1 and set the size to the size of the blur kernel. However, near the mask borders, a frontier can be seen between the nonblurred area (this inside of the mask) and the blurred area. Using more blur sizes will give a much smoother transition.
The idea for the builtup blurs to expand RGB comes from the EdgeExtend effect for Nuke by Frank Rueter (except the blurs were merged from the smallest to the largest, and here it is done the other way round), with suggestions by Lucas Pfaff.
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 

Premult Source / 
Boolean 
Off 
Premultiply the source image by its alpha channel before processing. Do not check if the source matte is already premultiplied 
Size / 
Double 
20 
Maximum blur kernel size applied in the ExtendSlices filter. Raise to extend the edges further. 
Slices / 
Integer 
5 
Number of blur kernels applied in the ExtendSlices filter. A count of 1 just merges the source image over the source image blurred by a kernel of size Size. 
Unpremult Result / 
Boolean 
Off 
Unpremultiply the result image by its alpha channel after processing. 
Filter / 
Choice 
QuasiGaussian 
Bluring filter. The quasiGaussian filter should be appropriate in most cases. The Gaussian filter is more isotropic (its impulse response has rotational symmetry), but slower.
QuasiGaussian (quasigaussian): QuasiGaussian filter (0order recursive Deriche filter, faster)  IIR (infinite support / impulsional response).
Gaussian (gaussian): Gaussian filter (Van Vliet recursive Gaussian filter, more isotropic, slower)  IIR (infinite support / impulsional response).
Box (box): Box filter  FIR (finite support / impulsional response).
Triangle (triangle): Triangle/tent filter  FIR (finite support / impulsional response).
Quadratic (quadratic): Quadratic filter  FIR (finite support / impulsional response).

Expand RoD / 
Boolean 
On 
Expand the source region of definition by 1.5*size (3.6*sigma). 
Crop To Format / 
Boolean 
On 
If the source is inside the format and the effect extends it outside of the format, crop it to avoid unnecessary calculations. To avoid unwanted crops, only the borders that were inside of the format in the source clip will be cropped. 
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. 