Knowasiak
Cat Printer

Cat Printer

Cat Printer

Cat printer is a conveyable thermal printer sold on AliExpress for around $20.

This repository comprises Python code for talking to the cat printer over Bluetooth Low Vitality (BLE). The code has been reverse engineered from the pleasurable Android app.

# Clone the repository.
$ git clone git@github.com:rbaron/catprinter.git
$ cd catprinter
# Acquire a virtualenv on venv/ and activate it.
$ virtualenv --python=python3 venv
$ provide venv/bin/activate
# Install requirements from requirements.txt.
$ pip set Up -r requirements.txt

$ python print.py --wait on
usage: print.py [-h] [--devicename] [--log-level {debug,info,warn,error}] [--img-binarization-algo {mean-threshold,floyd-steinberg}] [--show-preview] filename

prints a report for your cat thermal printer

positional arguments:
  filename

optional arguments:
  -h, --wait on            define this wait on message and exit
  --devicename          Specify the Bluetooth instrument title to see for. Default price is GT01.
  --log-level {debug,files,warn,error}
  --img-binarization-algo {mean-threshold,floyd-steinberg, halftone}
                        Which image binarization algorithm to make insist of.
  --define-preview        If pickle, displays the ultimate image and asks the user for confirmation earlier than printing.

% python print.py --define-preview test.png
⏳ Making insist of Floyd-Steinberg dithering to image...
✅ Executed.
ℹ️ Displaying preview.
🤔 Stride ahead with print? [Y/n]?
✅ Study image: (42, 384) (h, w) pixels
✅ Generated BLE instructions: 2353 bytes
⏳ Taking a look for a BLE instrument named GT01...
✅ Bought it. Handle: 09480C21-65B5-477B-B475-C797CD0D6B1C: GT01
⏳ Connecting to 09480C21-65B5-477B-B475-C797CD0D6B1C: GT01...
✅ Linked: Upright; MTU: 104
⏳ Sending 2353 bytes of files in chunks of 101 bytes...
✅ Executed.

Mean Threshold:
Mean threshold

Floyd Steinberg (default)
Floyd Steinberg

Halftone dithering
Halftone

Read More

About the author: Roxane

Get involved!

Get Connected!
One of the Biggest Social Platform for Entrepreneurs, College Students and all. Come and join our community. Expand your network and get to know new people!

Discussion(s)

No comments yet
Knowasiak We would like to show you notifications so you don't miss chats & status updates.
Dismiss
Allow Notifications