3. Parsing existing Rasters#

3.1. Parsing existing Rasters#

class brother_ql.reader.BrotherQLReader(brother_file: str | BufferedReader)#

Class for decoding raw printer instruction rasters

analyse()#

Analyzes the instruction file and prints the results, decoding rasters and saving them as images in the current working directory.

brother_ql.reader.chunker(data: bytes, raise_exception=False)#

Breaks data stream (bytes) into a list of bytes objects containing single instructions each.

Logs warnings for unknown opcodes or raises an exception instead, if raise_exception is set to True.

returns: list of bytes objects

brother_ql.reader.hex_format(data: bytes)#

Prints the hexadecimal representation of some bytes

brother_ql.reader.interpret_response(data: bytes) dict[str, Any]#

Interprets a raw response received from the printer

brother_ql.reader.match_opcode(data: bytes)#

Finds the opcode matching the given instruction

brother_ql.reader.merge_specific_instructions(chunks, join_preamble=True, join_raster=True)#

Process a list of instructions by merging subsequent instuctions with identical opcodes into “large instructions”.