Package jbig2

Overview ▾

Package jbig2 provides the jbig2 standard image Encoder and Decoder. All the comments reference to the 'ISO/IEC 14992 INFORMATION TECHNOLOGY - CODED REPRESENTATION OF PICTURE AND AUDIO INFORMATION - LOSSY/LOSSLESS CODING OF BI-LEVEL IMAGES JBIG committee 1999 July 16' document. The document is available and can be downloaded at: 'https://github.com/agl/jbig2enc/blob/master/fcd14492.pdf'

The decoder was based on the 'Apache PDFBox JBIG2 Java plugin' which can be found at: 'https://github.com/apache/pdfbox-jbig2'.

func DecodeBytes

func DecodeBytes(encoded []byte, parameters decoder.Parameters, globals ...Globals) ([]byte, error)

DecodeBytes decodes jbig2 'encode' byte slice data, with provided 'parameters' and optional 'globals'. The function decodes only a single page from the given input.

type Globals

Globals is the v3 mapping of the jbig2 segments to header mapping.

type Globals map[int]*segments.Header

func DecodeGlobals

func DecodeGlobals(encoded []byte) (Globals, error)

DecodeGlobals decodes globally defined data segments from the provided 'encoded' byte slice.

func (Globals) ToDocumentGlobals

func (g Globals) ToDocumentGlobals() *document.Globals

ToDocumentGlobals converts 'jbig2.Globals' into '*document.Globals'


Name Synopsis