dreamworkAPI
Ctrl K
GitHub
typeDocs / lzw / Options

lzw.Options

typesharedmenusource

Options of lzw.compress and lzw.decompress, every field is optional and both sides must use the same ones.

Common formats:

  • GIF image data (without the sub-block framing): { bit_order = "lsb", literal_bits = <LZW minimum code size>, max_width = 12, clear_code = true, end_code = true }
  • TIFF and PDF LZWDecode: { max_width = 12, clear_code = true, end_code = true, early_change = true }

Fields

NameTypeDescription
bit_order?"msb" | "lsb"The order codes are packed into bytes in, "msb" by default.
literal_bits?integerThe bit size of input bytes ( 1 - 8 ), the first 2 ^ literal_bits codes are literals, 8 by default.
max_width?integerThe maximum code width in bits ( up to 16 ), 16 by default.
clear_code?booleanReserves the code after the literals as the clear code, the encoder starts with it and sends it when the dictionary is full, false by default.
end_code?booleanReserves the next code as the end of data, everything after it is ignored, false by default.
early_change?booleanCode width grows one code early, like TIFF and PDF do, false by default.
on_full?"reset" | "freeze"What happens when the dictionary is full, "reset" starts over (sending the clear code if there is one), "freeze" keeps it as is, "reset" by default.
alphabet?stringWrites the bit stream as characters of this alphabet instead of bytes, its length must be a power of two, e.g. 64 characters for a base64-like stream.
pad?string | falseThe character that pads alphabet output to whole bytes like base64 does, "=" by default, false disables padding.
Generated from the dreamwork meta branch.