|
JPEG2000 影像格式支援
總覽
HotPDF 現在為 JPEG2000 影像格式提供完整支援,包括 JP2、J2K 與 JPT 檔案。JPEG2000 是基於小波(wavelet)的影像壓縮標準,相較於傳統 JPEG 可提供更好的壓縮效率與品質
支援的格式
- JP2: 具完整檔案結構的 JPEG2000 Part 1 格式
- J2K: JPEG2000 碼流格式(原始壓縮資料)
Key Features
- Automatic format detection and appropriate processing
- Support for both lossless and lossy compression
- Multi-component image support (RGB, RGBA, Grayscale)
- Advanced bit-depth support (8, 12, 16 bits per component)
- 自動偵測格式並採用合適的處理方式
- 同時支援無損與有損壓縮
- 支援多 component 影像(RGB、RGBA、灰階)
- 進階位元深度支援(每 component 8、12、16 位元)
- 支援漸進式解碼
- 大型影像的省記憶體處理
使用範例
// 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 影像的主解碼類別
- 格式偵測: 自動識別 JP2、J2K 與 JPT 格式
- 串流處理: 支援檔案與串流兩種影像載入方式
InspectHeaderFromByteArray reads dimensions, components and SourceColorSpace without decoding pixel samples
- Stream Processing: Support for both file and stream-based image loading
- Tile Access:
LoadTileFromByteArray decodes one validated tile and reports its source offset and grid
- Resolution Selection:
LoadRegionFromByteArray combines a source rectangle with a wavelet reduction factor
- Parallel Tile Decode:
LoadRegionFromByteArrayParallel uses independent decoder instances and deterministic row-major composition
- Loaded PDFs:
DecodeLoadedImageRegionAtResolution selects a level that does not under-resolve either target dimension
- Operation Controls:
JPEG2000ParallelTileDecoding and JPEG2000TileWorkerLimit control renderer integration, while GetLastJPEG2000ParallelDecodeStats reports scheduling and budget estimates
- OpenJPEG 整合: 使用 OpenJPEG library 進行進階處理的框架
效能優勢
- Better compression ratios than traditional JPEG
- 比傳統 JPEG 更好的壓縮率
- 高壓縮率下沒有區塊失真
- 漸進式傳輸與檢視
- 支援關注區域(ROI)編碼
- 無損壓縮選項
相容性
JPEG2000 支援可用於 HotPDF 的 32 位元與 64 位元版本,並與所有支援的 Delphi 與 C++Builder 版本相容
請參閱
|