AddImageJBIG2FromFile

Image handling

Description

Loads a bitmap file, converts it to a monochrome image, applies optional scan cleanup, and stores it as a JBIG2 image XObject

Syntax

Delphi

Function TPDFlib.AddImageJBIG2FromFile(Const FileName: WideString; Options, BlackDotSize, LossyLevel: Integer): Integer;

Parameters

FileNameBitmap file to encode
OptionsBit 0 writes Interpolate, bit 1 enables symbol dictionaries where available, bit 2 prefers the external encoder backend, and bit 3 enables isolated black-dot cleanup before encoding
BlackDotSizeMaximum isolated black-pixel cluster size removed when cleanup is enabled
LossyLevelCleanup aggressiveness hint from 0 to 9 for scanned monochrome input

Return values

Returns the new ImageID, or 0 when the file cannot be read or encoded

Remarks

This helper is intended for scanned black-and-white input where JBIG2 can reduce PDF size more than Flate or CCITT paths

See also

AddImageJBIG2FromStream, AddImageJBIG2FromString, AddImageJBIG2DirectFromFile