public class ContentAwareFillWatermarkOptions extends WatermarkOptions
The common Content Aware Fill Algorithm options.
The example shows how to remove any object from the image using Graphics Path with Content Aware fill algorithm.
String imageFilePath = "ball.png";
try (Image image = Image.load(imageFilePath))
{
PngImage pngImage = (PngImage)image;
GraphicsPath mask = new GraphicsPath();
Figure firstFigure = new Figure();
firstFigure.addShape(new EllipseShape(new RectangleF(350, 170, 570 - 350, 400 - 170)));
mask.addFigure(firstFigure);
ContentAwareFillWatermarkOptions options = new ContentAwareFillWatermarkOptions(mask);
options.setMaxPaintingAttempts(4);
try (Image result = WatermarkRemover.paintOver(pngImage, options))
{
result.Save(outputPath);
}
}
| Constructor and Description |
|---|
ContentAwareFillWatermarkOptions(GraphicsPath mask)
Initializes a new instance of the
ContentAwareFillWatermarkOptions class. |
ContentAwareFillWatermarkOptions(Point[] mask)
Initializes a new instance of the
ContentAwareFillWatermarkOptions class. |
| Modifier and Type | Method and Description |
|---|---|
Rectangle |
getInterestArea()
Gets the area to take patches.
|
int |
getMaxPaintingAttempts()
Gets the maximum number of painting attempts.
|
byte |
getPatchSize()
Gets the patch size (should be odd).
|
void |
setInterestArea(Rectangle value)
Sets the area to take patches.
|
void |
setMaxPaintingAttempts(int value)
Sets the maximum number of painting attempts.
|
void |
setPatchSize(byte value)
Sets the patch size (should be odd).
|
getGraphicsPathMask, getMask, getPrecalculationProgressEventHandler, setGraphicsPathMask, setMask, setPrecalculationProgressEventHandlerpublic ContentAwareFillWatermarkOptions(Point[] mask)
Initializes a new instance of the ContentAwareFillWatermarkOptions class.
mask - The mask for the unknown area.public ContentAwareFillWatermarkOptions(GraphicsPath mask)
Initializes a new instance of the ContentAwareFillWatermarkOptions class.
mask - The mask for the unknown area.public final byte getPatchSize()
Gets the patch size (should be odd).
Value: The size of the patch.public final void setPatchSize(byte value)
Sets the patch size (should be odd).
Value: The size of the patch.value - the patch size (should be odd).public final int getMaxPaintingAttempts()
Gets the maximum number of painting attempts. The algorithm will chose the best variant.
Value: The maximum number of painting attempts.The example shows how to remove any object from the image using Graphics Path with Content Aware fill algorithm.
String imageFilePath = "ball.png";
try (Image image = Image.load(imageFilePath))
{
PngImage pngImage = (PngImage)image;
GraphicsPath mask = new GraphicsPath();
Figure firstFigure = new Figure();
firstFigure.addShape(new EllipseShape(new RectangleF(350, 170, 570 - 350, 400 - 170)));
mask.addFigure(firstFigure);
ContentAwareFillWatermarkOptions options = new ContentAwareFillWatermarkOptions(mask);
options.setMaxPaintingAttempts(4);
try (Image result = WatermarkRemover.paintOver(pngImage, options))
{
result.Save(outputPath);
}
}
public final void setMaxPaintingAttempts(int value)
Sets the maximum number of painting attempts. The algorithm will chose the best variant.
Value: The maximum number of painting attempts.value - the maximum number of painting attempts.The example shows how to remove any object from the image using Graphics Path with Content Aware fill algorithm.
String imageFilePath = "ball.png";
try (Image image = Image.load(imageFilePath))
{
PngImage pngImage = (PngImage)image;
GraphicsPath mask = new GraphicsPath();
Figure firstFigure = new Figure();
firstFigure.addShape(new EllipseShape(new RectangleF(350, 170, 570 - 350, 400 - 170)));
mask.addFigure(firstFigure);
ContentAwareFillWatermarkOptions options = new ContentAwareFillWatermarkOptions(mask);
options.setMaxPaintingAttempts(4);
try (Image result = WatermarkRemover.paintOver(pngImage, options))
{
result.Save(outputPath);
}
}
public final Rectangle getInterestArea()
Gets the area to take patches.
Value: The area of interest to take patches.public final void setInterestArea(Rectangle value)
Sets the area to take patches.
Value: The area of interest to take patches.value - the area to take patches.Copyright (c) 2008-2025 Aspose Pty Ltd. All Rights Reserved.