Class ContentAwareFillWatermarkOptions

Class ContentAwareFillWatermarkOptions

Namespace: Aspose.Imaging.Watermark.Options
Assembly: Aspose.Imaging.dll (25.7.0)

The common Content Aware Fill Algorithm options.

public class ContentAwareFillWatermarkOptions : WatermarkOptions
   {
       public int MaxIterations { get; set; }
       public bool ApplyOnGrayscale { get; set; }
       public bool SmoothByGaussianBlur { get; set; }
       public double GaussianBlurSigma { get; set; }
   }

Inheritance

object WatermarkOptions ContentAwareFillWatermarkOptions

Inherited Members

WatermarkOptions.Mask , WatermarkOptions.PrecalculationProgressEventHandler , WatermarkOptions.GraphicsPathMask , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

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

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);
   }

Constructors

ContentAwareFillWatermarkOptions(Point[])

Initializes a new instance of the Aspose.Imaging.Watermark.Options.ContentAwareFillWatermarkOptions class.

public ContentAwareFillWatermarkOptions(Point[] mask)
   {
      this.Mask = mask;
   }

Parameters

mask Point []

The mask for the unknown area.

ContentAwareFillWatermarkOptions(GraphicsPath)

Initializes a new instance of the Aspose.Imaging.Watermark.Options.ContentAwareFillWatermarkOptions class.

public ContentAwareFillWatermarkOptions(GraphicsPath mask)
   {
      this._mask = mask;
   }
Here's your reformatted C# code with proper indentation, spacing and general readability improvements:
public ContentAwareFillWatermarkOptions(GraphicsPath mask)
{
    this._mask = mask;
}

Parameters

mask GraphicsPath

The mask for the unknown area.

Properties

InterestArea

Gets or sets the area to take patches.

public Rectangle InterestArea
    {
        get;
        set;
    }

Property Value

Rectangle

MaxPaintingAttempts

Gets or sets the maximum number of painting attempts.The algorithm will chose the best variant.

public int MaxPaintingAttempts
   {
      get;
      set;
   }

Property Value

int

Examples

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

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);
   }

PatchSize

Gets or sets the patch size (should be odd).

public byte PatchSize
    {
        get;
        set;
    }

Property Value

byte

 English