TJpeg2000Bitmap
Image handling
Description
TJpeg2000Bitmap (unit Lib\PDFlibJpeg2000.pas) is a TBitmap descendant that loads and saves raster data as JPEG 2000 images, so it drops into any VCL graphics code that consumes a bitmap
It loads both files with a JP2 header and raw code streams, but saves only files with a JP2 header, using either lossless compression or lossy compression at a chosen quality level
Syntax
Delphi
TJpeg2000Bitmap = Class(TBitmap)
Public
Constructor Create; Override;
Procedure LoadFromStream(Stream: TStream); Override;
Procedure SaveToStream(Stream: TStream); Override;
Procedure SetCMYK(UseCMYK: Boolean);
Property LosslessCompression: Boolean;
Property CompressionQuality: 1..100;
End;Key members
LoadFromStream | Decodes a JPEG 2000 image (JP2 header or raw code stream) into the bitmap |
|---|---|
SaveToStream | Encodes the bitmap as a JP2 file; configure the mode with the properties below |
SetCMYK | Selects CMYK instead of RGB channel order when saving |
LosslessCompression | True saves losslessly; False (default) saves lossy |
CompressionQuality | Quality of lossy compression from 1 (small file) to 100 (maximum quality), default 80 |
Remarks
Images with more or less than 8 bits per channel are resampled to 8 bit; YCC color spaces are converted to RGB; grayscale images load as 8-bit indexed bitmaps with the default grayscale palette; images with 2 or 4+ channels are treated as grayscale and only the first channel is loaded; JPEG 2000 images using an ICC profile or palette are not supported, though raw pixel data is still loaded; an opacity channel produces a 32-bit bitmap with the alpha format set on supported Delphi versions