AddModernImageFromFile
Image handling, Modern image codecs
Description
Adds the primary image from an AVIF, HEIF, HEIC, or JPEG XL file through the configured in-process decoder
The decoder applies encoded orientation and transfers the decoded samples through a PNG bridge so alpha, ICC colour profiles, and up to 16 bits per component reach the PDF image path
Syntax
Function TPDFlib.AddModernImageFromFile(
Const FileName: WideString;
Options: Integer= 8): Integer;
Parameters
| FileName | Path to an AVIF, HEIF, HEIC, or JPEG XL file |
|---|---|
| Options | PNG-compatible import mode, where the default 8 retains image data, alpha, ICC, and high-bit-depth samples |
Return values
Returns the new ImageID or 0 when the file, format, decoder, or decoded image is invalid
Remarks
Both lossy and lossless source encodings are accepted, while animated or multi-image containers import their primary image
Call SetModernImageCodecLibrary before the first availability check or decode when the codec library is not on the default search path
A retained 16-bit image automatically raises an unlocked document to PDF 1.5 through the normal compatibility gate
See also
AddModernImageFromStream, AddModernImageFromString, ModernImageCodecAvailable