Class ContentAwareFillWatermarkOptions

ContentAwareFillWatermarkOptions class

The common Content Aware Fill Algorithm options.

public class ContentAwareFillWatermarkOptions : WatermarkOptions

Constructors

NameDescription
ContentAwareFillWatermarkOptions(GraphicsPath)Initializes a new instance of the ContentAwareFillWatermarkOptions class.
ContentAwareFillWatermarkOptions(Point[])Initializes a new instance of the ContentAwareFillWatermarkOptions class.

Properties

NameDescription
GraphicsPathMask { get; set; }Gets or sets the mask.
InterestArea { get; set; }Gets or sets the area to take patches.
Mask { get; set; }Gets or sets the mask.
MaxPaintingAttempts { get; set; }Gets or sets the maximum number of painting attempts. The algorithm will chose the best variant.
PatchSize { get; set; }Gets or sets the patch size (should be odd).
PrecalculationProgressEventHandler { get; set; }Gets or sets the default points pre-calculation process progress event handler.

Examples

The example shows how to remove any object from the image using Graphics Path with Content Aware fill algorithm.

[C#]

var imageFilePath = "ball.png"; 
using (var image = Image.Load(imageFilePath))
{
    var pngImage = (PngImage)image;

    var mask = new GraphicsPath();
    var firstFigure = new Figure();
    firstFigure.AddShape(new EllipseShape(new RectangleF(350, 170, 570 - 350, 400 - 170)));
    mask.AddFigure(firstFigure);

    var options = new ContentAwareFillWatermarkOptions(mask) 
    { 
        MaxPaintingAttempts = 4
    };

    var result = WatermarkRemover.PaintOver(pngImage, options);

    result.Save(outputPath);
}

See Also