-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Evgeniy Sidenko
committed
Dec 4, 2024
1 parent
29f7926
commit 715cee4
Showing
3 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...c/main/java/com/aspose/imaging/examples/ModifyingImages/UnifyUsageOfCommonOperations.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.aspose.imaging.examples.ModifyingImages; | ||
|
||
import com.aspose.imaging.*; | ||
import com.aspose.imaging.examples.Logger; | ||
import com.aspose.imaging.examples.Utils; | ||
import com.aspose.imaging.fileformats.opendocument.OdImage; | ||
import com.aspose.imaging.imageoptions.PngOptions; | ||
import com.aspose.imaging.imageoptions.VectorRasterizationOptions; | ||
|
||
public class UnifyUsageOfCommonOperations | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
Logger.startExample(); | ||
// The path to the documents' directory. | ||
String dataDir = Utils.getSharedDataDir() + "CDR/"; | ||
String fileName = "test.cdr"; | ||
String inputFileName = dataDir + fileName; | ||
String outputFileNamePng = Utils.getOutDir() + "output.png"; | ||
|
||
try (Image image = Image.load(inputFileName)) | ||
{ | ||
if (image instanceof OdImage) | ||
{ | ||
image.crop(new Rectangle(92, 179, 260, 197)); | ||
} | ||
else | ||
{ | ||
image.crop(new Rectangle(88, 171, 250, 190)); | ||
} | ||
|
||
image.save(outputFileNamePng, new PngOptions() | ||
{{ | ||
setVectorRasterizationOptions(new VectorRasterizationOptions() | ||
{{ | ||
setPageSize(Size.to_SizeF(image.getSize())); | ||
setTextRenderingHint(TextRenderingHint.SingleBitPerPixel); | ||
setSmoothingMode(SmoothingMode.None); | ||
|
||
}}); | ||
}}); | ||
} | ||
Utils.deleteFile(outputFileNamePng); | ||
Logger.endExample(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters