Skip to content

Commit 245cb43

Browse files
author
Evgeniy Sidenko
committed
Updated upto 23.8
1 parent 5c84430 commit 245cb43

File tree

5 files changed

+54
-11
lines changed

5 files changed

+54
-11
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.7</version>
6+
<version>23.8</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.7</version>
18+
<version>23.8</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.7</version>
25+
<version>23.8</version>
2626
<classifier>javadoc</classifier>
2727
<type>jar</type>
2828
</dependency>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package com.aspose.imaging.examples.ModifyingImages;
2+
3+
import com.aspose.imaging.Image;
4+
import com.aspose.imaging.RasterImage;
5+
import com.aspose.imaging.examples.Logger;
6+
import com.aspose.imaging.examples.Utils;
7+
import com.aspose.imaging.magicwand.MagicWandSettings;
8+
import com.aspose.imaging.magicwand.MagicWandTool;
9+
import com.aspose.imaging.magicwand.imagemasks.FeatheringSettings;
10+
import com.aspose.imaging.magicwand.imagemasks.RectangleMask;
11+
12+
public class MagicWandToolTest
13+
{
14+
public static void main(String[] args)
15+
{
16+
Logger.startExample("ImageTransparency");
17+
// The path to the documents' directory.
18+
19+
String dataDir = Utils.getSharedDataDir() + "Png/";
20+
String outDir = Utils.getOutDir("Png");
21+
try (RasterImage image = (RasterImage) Image.load(dataDir + "src.png"))
22+
{
23+
// Create a new mask using magic wand tool based on tone and color of pixel {845, 128}
24+
MagicWandTool.select(image, new MagicWandSettings(845, 128))
25+
// Union the existing mask with the specified one created by magic wand tool
26+
.union(new MagicWandSettings(416, 387))
27+
// Invert the existing mask
28+
.invert()
29+
// Subtract the specified mask created by magic wand tool from the existing one
30+
.subtract(new MagicWandSettings(1482, 346) {{ setThreshold(69); }})
31+
// Subtract four specified rectangle masks from the existing mask one by one
32+
.subtract(new RectangleMask(0, 0, 800, 150))
33+
.subtract(new RectangleMask(0, 380, 600, 220))
34+
.subtract(new RectangleMask(930, 520, 110, 40))
35+
.subtract(new RectangleMask(1370, 400, 120, 200))
36+
// Feather mask with specified settings
37+
.getFeathered(new FeatheringSettings() {{ setSize(3); }})
38+
// Apply mask to the image
39+
.apply();
40+
image.save(outDir + "/result.png");
41+
}
42+
43+
Utils.deleteFile(outDir + "/result.png");
44+
45+
Logger.endExample();
46+
}
47+
}

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+
MagicWandToolTest.main(args);
115116
AddAlphaBlendingForImage.main(args);
116117
BigTiffLoadExample.main(args);
117118
KeepTransparencyWhenIndexingPngImage.main(args);

Examples/src/main/java/com/aspose/imaging/examples/images/GraphicsMeasureString.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,17 @@ public class GraphicsMeasureString
99
public static void main(String[] args)
1010
{
1111
Logger.startExample();
12-
String dataDir = Utils.getSharedDataDir() + "gif/";
12+
String dataDir = Utils.getSharedDataDir() + "jpeg/";
1313
// Declare variable to store file path for input image
14-
String path = dataDir + "ezgif.com-gif-maker(1)___.gif";
14+
String path = dataDir + "input.jpg";
1515

16-
com.aspose.imaging.RasterImage backgroundImage = (com.aspose.imaging.RasterImage) Image.load(path);
17-
try
16+
try (RasterImage backgroundImage = (RasterImage) Image.load(path))
1817
{
1918
Graphics gr = new Graphics(backgroundImage);
2019
StringFormat format = new StringFormat();
2120
SizeF size = gr.measureString("Test", new Font("Arial", 10), SizeF.getEmpty(), format);
2221
System.out.println("Size: " + size);
2322
}
24-
finally
25-
{
26-
backgroundImage.close();
27-
}
2823
Logger.endExample();
2924
}
3025
}
1.6 MB
Loading

0 commit comments

Comments
 (0)