GroupDocs를 사용한 스캔 이미지 Java 마스킹 방법

오늘날 디지털 환경에서 redact scanned image java는 개인정보 보호와 규정 준수를 위해 필수적입니다. 스캔된 계약서에서 개인 데이터를 숨기거나 의료 이미지에서 환자 정보를 가려야 할 때, 이 튜토리얼은 GroupDocs.Redaction for Java를 사용하여 이미지 마스킹을 빠르고 안정적으로 수행하는 방법을 보여줍니다. 프로젝트 설정부터 마스킹이 성공했는지 확인하는 단계까지 모두 안내하므로, 어떤 Java 애플리케이션에도 자신 있게 통합할 수 있습니다.

Quick Answers

  • What library handles image redaction in Java? GroupDocs.Redaction for Java
  • Can I choose the redaction color? Yes – any java.awt.Color (e.g., Color.BLUE)
  • Is a license required for production? Yes, a valid GroupDocs license is needed
  • Will the original image be overwritten? No – you save the result to a new file
  • What Java version is supported? Java 8+ (compatible with modern JDKs)

이미지 마스킹이란 무엇이며 왜 스캔 이미지 Java를 마스킹해야 할까요?

이미지 마스킹은 이름, 번호, 서명 등 민감한 시각 정보를 영구적으로 가려 복구할 수 없게 만드는 작업입니다. 스캔 문서는 데이터가 픽셀 형태로 포함되어 있기 때문에 기존 텍스트 마스킹 도구로는 효과를 보기 어렵습니다. GroupDocs.Redaction을 사용하면 정확한 픽셀 영역을 지정하고 단색으로 교체하여 정보를 완전히 제거할 수 있습니다.

Prerequisites

시작하기 전에 다음이 준비되어 있는지 확인하세요:

  • JDK 8 이상 설치
  • Maven(또는 다른 빌드 도구)으로 의존성 관리
  • IntelliJ IDEA, Eclipse, NetBeans 등 IDE
  • 기본적인 Java 지식 및 파일 I/O에 대한 이해

GroupDocs.Redaction for Java 설정

Maven Setup

pom.xml에 GroupDocs 저장소와 의존성을 추가합니다:

<repositories>
   <repository>
      <id>repository.groupdocs.com</id>
      <name>GroupDocs Repository</name>
      <url>https://releases.groupdocs.com/redaction/java/</url>
   </repository>
</repositories>

<dependencies>
   <dependency>
      <groupId>com.groupdocs</groupId>
      <artifactId>groupdocs-redaction</artifactId>
      <version>24.9</version>
   </dependency>
</dependencies>

Direct Download

또는 공식 릴리스 페이지에서 최신 JAR를 다운로드하세요: GroupDocs.Redaction for Java releases.

License Acquisition

  • Free Trial: 체험판에 가입하여 API를 살펴볼 수 있습니다.
  • Temporary License: 장기 테스트를 위해 임시 키를 사용합니다.
  • Full Purchase: 무제한 사용을 위한 정식 라이선스를 구매합니다.

Implementation Guide

구현은 두 가지 핵심 기능으로 나뉩니다: Image Area Redaction(실제 마스킹)과 Redaction Status Check(성공 여부 확인).

How to redact scanned document images – Step 1: Initialize the Redactor

먼저, 처리할 이미지를 가리키는 Redactor 인스턴스를 생성합니다.

final Redactor redactor = new Redactor("YOUR_DOCUMENT_DIRECTORY/SAMPLE_JPG");

Step 2: Define Redaction Parameters

가리고자 하는 사각형의 좌상단(Point)과 크기(Dimension)를 지정합니다. 이 예제에서는 파란색 채우기를 사용합니다.

// Define the position on the image where redaction starts.
Point samplePoint = new Point(385, 485);

// Define the size of the area to be redacted.
Dimension sampleSize = new Dimension(1793, 2069);

Step 3: Apply Redaction

RegionReplacementOptions와 함께 ImageAreaRedaction 객체를 만들고 실행합니다. 메서드는 작업 성공 여부를 알려주는 RedactorChangeLog를 반환합니다.

RedactorChangeLog result = redactor.apply(
    new ImageAreaRedaction(samplePoint, new RegionReplacementOptions(Color.BLUE, sampleSize))
);

// Check if the redaction was successful and save the output.
if (result.getStatus() != RedactionStatus.Failed) {
    redactor.save("YOUR_OUTPUT_DIRECTORY/redacted_output.jpg");
}

Step 4: Release Resources

작업이 끝나면 항상 Redactor를 닫아 네이티브 리소스를 해제합니다.

redactor.close();

How to verify the redaction – Status Check

마스킹을 적용한 후 RedactorChangeLog를 검사하여 작업이 실패하지 않았는지 확인할 수 있습니다.

if (result != null && result.getStatus() != RedactionStatus.Failed) {
    System.out.println("Redaction was successful.");
} else {
    System.out.println("Redaction failed.");
}

Practical Applications

  • Confidential Document Handling: 외부 파트너와 공유하기 전에 스캔된 계약서에서 개인 데이터를 자동으로 마스킹합니다.
  • Legal Documentation: 증거 이미지에서 식별자를 마스킹하여 GDPR 또는 HIPAA 준수를 보장합니다.
  • Medical Records: 방사선 이미지에서 얼굴이나 손글씨 메모를 가려 환자 프라이버시를 보호합니다.

Performance Considerations

  • Batch Processing: 메모리 사용량을 낮게 유지하려면 작은 배치 단위로 이미지를 로드하고 마스킹합니다.
  • Efficient Data Structures: 다수의 이미지를 처리할 때 PointDimension 객체를 재사용합니다.
  • Stay Updated: 성능 향상 및 버그 수정을 위해 최신 GroupDocs.Redaction 버전으로 정기적으로 업그레이드합니다.

Common Issues & Solutions

IssueCauseFix
Redaction fails with Failed statusIncorrect file path or unsupported image formatVerify the image exists and is a supported format (JPG, PNG, BMP).
Output file is emptyredactor.save() called before redaction completesEnsure apply() returns a successful status before saving.
Color not appliedUsing a transparent colorChoose an opaque Color (e.g., Color.BLACK or Color.BLUE).

Frequently Asked Questions

Q: What is the difference between ImageAreaRedaction and text redaction?
A: ImageAreaRedaction works on pixel coordinates, while text redaction parses OCR layers to locate and remove textual content.

Q: Can I redact multiple regions in a single image?
A: Yes—call redactor.apply() repeatedly with different ImageAreaRedaction objects before saving.

Q: Does GroupDocs.Redaction support other image formats like TIFF?
A: The library supports common raster formats (JPG, PNG, BMP, GIF). For TIFF, convert to a supported format first.

Q: How do I automate redaction for a folder of scanned PDFs?
A: Iterate over each page image extracted from the PDF, apply the same redaction logic, and then rebuild the PDF using a PDF library.

Q: Is there a way to preview the redaction before saving?
A: You can render the Redactor to a BufferedImage and display it in a Swing or JavaFX UI before committing the changes.

Conclusion

이제 이미지 마스킹을 수행하고, 특히 GroupDocs.Redaction for Java를 사용해 스캔 이미지 Java 마스킹을 구현하는 완전한 프로덕션 가이드를 갖추었습니다. 위 단계들을 따라 하면 다양한 산업 분야에서 민감한 시각 데이터를 보호할 수 있습니다. 텍스트 마스킹이나 PDF 페이지 마스킹과 같은 추가 API를 활용해 조직 전체의 데이터 프라이버시 솔루션을 구축해 보세요.

Resources


Last Updated: 2026-03-22
Tested With: GroupDocs.Redaction 24.9 (Java)
Author: GroupDocs