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
OptionsPDF_JBIG2_OPTION_INTERPOLATE (1) writes Interpolate, PDF_JBIG2_OPTION_SYMBOL_EXTRACT (2) enables symbol dictionaries where available, PDF_JBIG2_OPTION_EXTERNAL_ENCODER (4) prefers the external encoder backend, and PDF_JBIG2_OPTION_SKIP_BLACK_DOTS (8) 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