JPEG2000 Image Format Support

Overview

HotPDF는 JP2와 J2K 파일을 포함한 JPEG2000 이미지 형식을 포괄적으로 지원합니다. JPEG2000은 웨이블릿 기반 이미지 압축 표준으로, 기존 JPEG 형식보다 뛰어난 압축 효율과 화질을 제공합니다

Supported Formats

  • JP2: JPEG2000 Part 1 format with complete file structure
  • J2K: JPEG2000 codestream format (raw compressed data)

Key Features

  • Automatic format detection and appropriate processing
  • 무손실 및 손실 압축 지원
  • Multi-component image support (RGB, RGBA, Grayscale)
  • Advanced bit-depth support (8, 12, 16 bits per component)
  • Direct validated codestream-tile decoding with tile-grid metadata
  • 원본 영역과 2의 거듭제곱 해상도 관심 영역을 결합한 디코딩
  • 악의적이거나 예상보다 큰 코드스트림에 대비한 디코딩 출력 예산
  • Automatic renderer resolution selection from visible target pixels
  • Bounded parallel reconstruction of independent intersecting tiles
  • Deterministic composition, cancellation, worker-limit, and peak-memory telemetry

Usage Example


// Delphi example - Adding JPEG2000 image to PDF
procedure AddJPEG2000Image;
var
  PDF: THotPDF;
begin
  PDF := THotPDF.Create(nil);
  try
    PDF.FileName := 'output.pdf';
    PDF.BeginDoc;
    PDF.AddPage;

    // Add JPEG2000 image - format is automatically detected
    PDF.AddImage('sample.jp2', 100, 100, 200, 150);

    // J2K codestream format is also supported
    PDF.AddImage('sample.j2k', 100, 300, 200, 150);

    PDF.EndDoc;
  finally
    PDF.Free;
  end;
end;
        

Technical Implementation

JPEG2000 지원은 HPDFJpeg2000.pas 유닛으로 구현되며, 다음을 제공합니다

  • THPDFJpeg2000Decoder: JPEG2000 이미지를 처리하는 메인 디코더 클래스입니다. 디코딩 후 THPDFJpeg2000Decoder.TileIndex, TileColumns, TileRows, TileOriginX, TileOriginY가 검증된 타일 그리드를 서술하고, THPDFJpeg2000Decoder.DecodedX와 DecodedY는 디코딩된 region의 소스 공간 원점을 보고하며, THPDFJpeg2000Decoder.GetImageData는 디코딩된 샘플을 호출자가 공급한 바이트 배열로 복사하고, THPDFJpeg2000Decoder.ParallelWorkingBudgetBytes는 병렬 작업 메모리를 제한하고, THPDFJpeg2000Decoder.LastParallelDecodeStats는 마지막 병렬 스케줄링 통계를 반환합니다
  • TJpeg2000Bitmap: JP2·J2K 래스터 데이터를 읽고 저장하는 VCL TBitmap 하위 클래스입니다. TJpeg2000Bitmap.LosslessCompression은 무손실 출력을 고르고, TJpeg2000Bitmap.CompressionQuality는 1부터 100까지의 손실 품질을 정하며, TJpeg2000Bitmap.SetCMYK는 RGB 대신 CMYK 샘플을 씁니다
  • 형식 감지: JP2, J2K, JPT 형식을 자동으로 식별합니다
  • 헤더 검사: InspectHeaderFromByteArray는 픽셀 샘플을 디코딩하지 않고 치수, 컴포넌트, SourceColorSpace를 읽습니다
  • 스트림 처리: 파일 기반과 스트림 기반 이미지 로딩을 모두 지원합니다
  • 타일 접근: LoadTileFromByteArray는 검증된 타일 하나를 디코딩하고 그 원본 오프셋과 그리드를 보고합니다
  • 해상도 선택: LoadRegionFromByteArray는 원본 사각형과 웨이블릿 축소 계수를 결합합니다
  • 병렬 타일 디코딩: LoadRegionFromByteArrayParallel은 독립적인 디코더 인스턴스를 쓰고 결정적인 row-major 합성을 수행합니다
  • 로드된 PDF: DecodeLoadedImageRegionAtResolution은 어느 대상 치수도 해상도가 부족해지지 않는 레벨을 선택합니다
  • 동작 제어: JPEG2000ParallelTileDecoding과 JPEG2000TileWorkerLimit는 렌더러 통합을 제어하고, GetLastJPEG2000ParallelDecodeStats는 스케줄링과 예산 추정치를 보고합니다
  • OpenJPEG 연동: Win32와 Win64에서 네이티브 링크 디코딩

Performance Benefits

  • Better compression ratios than traditional JPEG
  • No blocking artifacts at high compression rates
  • Progressive transmission and viewing
  • Region of interest (ROI) encoding support
  • 보이는 영역이 독립된 코드스트림 타일에 걸쳐 있을 때의 동시 재구성
  • Lossless compression option

Compatibility

JPEG2000 지원은 HotPDF의 32비트와 64비트 버전 모두에서 사용할 수 있으며, 지원되는 모든 Delphi 및 C++ Builder 버전과 호환됩니다

See Also