Skip to main content

encode_single_image

Function encode_single_image 

Source
pub fn encode_single_image(
    input: &[u8],
    width: u32,
    height: u32,
    pdf_mode: bool,
) -> Result<Jbig2EncodeResult, Jbig2Error>
Expand description

Main encoding function that handles both standalone and PDF fragment modes

This function encodes a single binary image into JBIG2 format. When PDF mode is enabled, it returns separate global dictionary and page data that can be properly embedded in PDF.

§Arguments

  • input - Binary image data (0/1 values)
  • width - Image width in pixels
  • height - Image height in pixels
  • pdf_mode - Whether to create PDF fragments (true) or standalone file (false)

§Returns

A Jbig2EncodeResult containing separate global and page data for PDF embedding, or combined data for standalone files.