DecodeOptions are the options used for the Decode process.
type DecodeOptions struct {
Columns int
Rows int
K int
EncodedByteAligned bool
BlackIsOne bool
EndOfBlock bool
EndOfLine bool
DamagedRowsBeforeError int
}
Decoder is the implementation of the CCITTFax stream decoder.
type Decoder struct {
// contains filtered or unexported fields
}
func NewDecoder(data []byte, options DecodeOptions) (*Decoder, error)
NewDecoder creates a new CCITTFax stream decoder.
func (d *Decoder) Read(in []byte) (int, error)
Read decoded bytes from the input stream. Implements io.Reader interface.
Encoder implements a CCITT facsimile (fax) Group3 and Group4 encoding/decoding algorithms.
type Encoder struct {
K int
EndOfLine bool
EncodedByteAlign bool
Columns int
Rows int
EndOfBlock bool
BlackIs1 bool
DamagedRowsBeforeError int
}
func (e *Encoder) Encode(pixels [][]byte) []byte
Encode encodes the original image pixels. Note: `pixels` here are the pixels of the image where each byte value is 1 for white pixels and 0 for the black ones.