Python package to talk to Brother QL label printers
Project description
brother_ql
A Python package to control Brother QL label printers. It implements the raster language of those printers and allows you to send instruction files to your printer. In more details, the following is possible with this package:
Create raster language files for the Brother label printers. They can be created from image files or programmatically in your own Python script.
Print raster instruction files with your Brother label printer via different backends:
pyusb (works cross-platform)
network (works cross-platform for WiFi/Ethernet-enabled printers)
linux_kernel (works on Linux only; uses the /dev/usb/lp0 device handles)
The following printers are claimed to be supported (✓ means verified by the author or by contributors):
QL-500 (✓), QL-550 (✓), QL-560, QL-570 (✓), QL-580N, QL-650TD, QL-700 (✓), QL-710W (✓), QL-720NW (✓), QL-800 (✓), QL-810W, QL-820NWB (✓), QL-1050 (✓), and QL-1060N.
The new QL-800 series can print labels with two colors (black and red) on DK-22251 labels.
Note: If your printer has an ‘Editor Lite’ mode, you need to disable it if you want to print via USB. Make sure that the corresponding LED is not lit by holding the button down until it turns off.
If you’re interested in printing labels using a web interface, have a look at my project brother_ql_web. It makes use of the brother_ql package and is also written in Python.
Why
The special feature of this package is that no printer driver is required for it to work. This software bypasses the whole printing system including printer drivers and directly talks to your label printer instead. This means that even though Brother doesn’t offer a driver for the Raspberry Pi (running Linux on ARM) you can print nicely using this software. And even if there are drivers for your operating system, many programs have difficulties to set the page sizes and margins for the labels correctly. If you want to print with high precision (which is important for barcodes for example), you rather want to have control about every single pixel to be printed. This is where brother_ql comes into the game.
Installation
brother_ql is available from PyPI with pip:
pip install brother_ql # or to upgrade to a newer release: pip install --upgrade brother_ql
Alternatively, you can install the latest development version from Github using:
pip install --upgrade https://github.com/pklaus/brother_ql/archive/master.zip
This package was mainly created for use with Python 3. The essential functionality, however, will also work with Python 2: the creation of label files.
Usage
The main user interface of this package is the command line tool brother_ql.
Usage: brother_ql [OPTIONS] COMMAND [ARGS]... Command line interface for the brother_ql Python package. Options: -b, --backend [pyusb|network|linux_kernel] -m, --model [QL-500|QL-550|QL-560|QL-570|QL-580N|QL-650TD|QL-700|QL-710W|QL-720NW|QL-800|QL-810W|QL-820NWB|QL-1050|QL-1060N] -p, --printer PRINTER_IDENTIFIER The identifier for the printer. This could be a string like tcp://192.168.1.21:9100 for a networked printer or usb://0x04f9:0x2015/000M6Z401370 for a printer connected via USB. --debug --help Show this message and exit. Commands: analyze interpret a binary file containing raster... discover find connected label printers info list available choices (for labels or models) print Print a label send send an instruction file to the printer
There are some global options available such as –model and –printer. They can also be provided by environment variables (BROTHER_QL_MODEL and BROTHER_QL_PRINTER).
The global options are followed by a command such as info or print. The most important command is the print command and here is its CLI signature:
Usage: brother_ql print [OPTIONS] IMAGE [IMAGE] ... Print a label of the provided IMAGE. Options: -l, --label [12|29|38|50|54|62|102|17x54|17x87|23x23|29x42|29x90|39x90|39x48|52x29|62x29|62x100|102x51|102x152|d12|d24|d58] The label (size, type - die-cut or endless). Run `brother_ql info list-labels` for a full list including ideal pixel dimensions. -r, --rotate [auto|0|90|180|270] Rotate the image (counterclock-wise) by this amount of degrees. -t, --threshold FLOAT The threshold value (in percent) to discriminate between black and white pixels. -d, --dither Enable dithering when converting the image to b/w. If set, --threshold is meaningless. -c, --compress Enable compression (if available with the model). Label creation can take slightly longer but the resulting instruction size is normally considerably smaller. --red Create a label to be printed on black/red/white tape (only with QL-8xx series on DK-22251 labels). You must use this option when printing on black/red tape, even when not printing red. --600dpi Print with 600x300 dpi available on some models. Provide your image as 600x600 dpi; perpendicular to the feeding the image will be resized to 300dpi. --lq Print with low quality (faster). Default is high quality. --no-cut / --cut Don't cut the tape after printing the label. --help Show this message and exit.
So, printing an image file onto 62mm endless tape on a QL-710W label printer can be as easy as:
export BROTHER_QL_PRINTER=tcp://192.168.1.21 export BROTHER_QL_MODEL=QL-710W brother_ql print -l 62 my_image.png
Legacy command line tools
For a long time, this project provided multiple command line tools, such as brother_ql_create, brother_ql_print, brother_ql_analyze, and more. A documentation of their usage can be found in the LEGACY.
Links
The source code and issue tracker of this package is to be found on Github: pklaus/brother_ql.
The package is also to be found on PyPI: brother_ql.
A collection of similar software projects can be found in SIMILAR_SOFTWARE.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for brother_ql-0.9.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0726f48d10848fcec5546643947b63e429e45ebd91bda2342869bfccfd99dace |
|
MD5 | c2259bee56b1dd71540e39ee110bd7fe |
|
BLAKE2b-256 | 9d20b07ab7b38cbf4950f549f84fc986246c8d9cad4e7d64f0731d9ea629b277 |