Created
October 3, 2024 08:50
-
-
Save farhan-raza/5756474ba6543d9ebce201ddf0b39c9f to your computer and use it in GitHub Desktop.
Redact Images in Java | Redact JPG PNG BMP GIF TIFF Photos
This file contains hidden or 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
final com.groupdocs.redaction.Redactor redactor = new com.groupdocs.redaction.Redactor(dataDir + "compare-annotations-pdf-java.jpg"); | |
try | |
{ | |
//Define the position on image | |
java.awt.Point samplePoint = new java.awt.Point(385, 485); | |
//Define the size of the area which need to be redacted | |
java.awt.Dimension sampleSize = new java.awt.Dimension(1793, 2069); | |
//Perform redaction | |
com.groupdocs.redaction.RedactorChangeLog result = redactor.apply(new com.groupdocs.redaction.redactions.ImageAreaRedaction(samplePoint, | |
new com.groupdocs.redaction.redactions.RegionReplacementOptions(java.awt.Color.BLUE, sampleSize))); | |
if (result.getStatus() != com.groupdocs.redaction.RedactionStatus.Failed) | |
{ | |
//The redacted output will save as PDF | |
redactor.save(); | |
}; | |
} | |
finally { redactor.close(); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment