Skip to content

Commit 96b0d11

Browse files
author
Evgeniy Sidenko
committed
Updated upto 23.9
Added the watermark removing example
1 parent 245cb43 commit 96b0d11

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

Examples/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.aspose</groupId>
55
<artifactId>imaging-java-examples</artifactId>
6-
<version>23.8</version>
6+
<version>23.9</version>
77
<packaging>jar</packaging>
88
<properties>
99
<maven.compiler.source>1.8</maven.compiler.source>
@@ -15,14 +15,14 @@
1515
<dependency>
1616
<groupId>com.aspose</groupId>
1717
<artifactId>aspose-imaging</artifactId>
18-
<version>23.8</version>
18+
<version>23.9</version>
1919
<classifier>jdk16</classifier>
2020
<type>jar</type>
2121
</dependency>
2222
<dependency>
2323
<groupId>com.aspose</groupId>
2424
<artifactId>aspose-imaging</artifactId>
25-
<version>23.8</version>
25+
<version>23.9</version>
2626
<classifier>javadoc</classifier>
2727
<type>jar</type>
2828
</dependency>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.aspose.imaging.examples.ModifyingImages;
2+
3+
import com.aspose.imaging.*;
4+
import com.aspose.imaging.examples.Logger;
5+
import com.aspose.imaging.examples.Utils;
6+
import com.aspose.imaging.fileformats.png.PngImage;
7+
import com.aspose.imaging.shapes.EllipseShape;
8+
import com.aspose.imaging.watermark.WatermarkRemover;
9+
import com.aspose.imaging.watermark.options.ContentAwareFillWatermarkOptions;
10+
11+
public class RemoveWatermarkFilter
12+
{
13+
public static void main(String[] args)
14+
{
15+
Logger.startExample();
16+
String baseFolder = Utils.getSharedDataDir() + "Png";
17+
String imageFilePath = baseFolder + "/ball.png";
18+
String outputFilePath = Utils.getOutDir() + "/result.png";
19+
try (Image image = Image.load(imageFilePath))
20+
{
21+
PngImage pngImage = (PngImage)image;
22+
GraphicsPath mask = new GraphicsPath();
23+
Figure firstFigure = new Figure();
24+
firstFigure.addShape(new EllipseShape(new RectangleF(350, 170, 570 - 350, 400 - 170)));
25+
mask.addFigure(firstFigure);
26+
27+
ContentAwareFillWatermarkOptions options = new ContentAwareFillWatermarkOptions(mask);
28+
options.setMaxPaintingAttempts(4);
29+
RasterImage result = WatermarkRemover.paintOver(pngImage, options);
30+
result.save(outputFilePath);
31+
}
32+
33+
Logger.endExample();
34+
}
35+
}

Examples/src/main/java/com/aspose/imaging/examples/RunExamples.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public static void main(String[] args) throws IOException, InterruptedException,
112112
//// =====================================================
113113

114114
Logger.println("Running modifying and converting images tests:");
115+
RemoveWatermarkFilter.main(args);
115116
MagicWandToolTest.main(args);
116117
AddAlphaBlendingForImage.main(args);
117118
BigTiffLoadExample.main(args);
539 KB
Loading

0 commit comments

Comments
 (0)