{"id":13624151,"url":"https://github.com/rbaron/catprinter","last_synced_at":"2025-12-24T04:24:55.187Z","repository":{"id":39793622,"uuid":"395928157","full_name":"rbaron/catprinter","owner":"rbaron","description":"🐱🖨","archived":false,"fork":false,"pushed_at":"2024-09-22T08:26:12.000Z","size":4935,"stargazers_count":752,"open_issues_count":8,"forks_count":56,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-11-08T12:43:03.992Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rbaron.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-14T07:26:18.000Z","updated_at":"2024-10-26T17:05:10.000Z","dependencies_parsed_at":"2024-11-08T12:33:16.777Z","dependency_job_id":"47791d71-4dfd-4b4e-b9af-168a15e29cdc","html_url":"https://github.com/rbaron/catprinter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbaron%2Fcatprinter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbaron%2Fcatprinter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbaron%2Fcatprinter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbaron%2Fcatprinter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rbaron","download_url":"https://codeload.github.com/rbaron/catprinter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249148357,"owners_count":21220520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T21:01:39.436Z","updated_at":"2025-12-24T04:24:55.135Z","avatar_url":"https://github.com/rbaron.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"![Cat Printer](./media/hackoclock.jpg)\n\nCat printer is a portable thermal printer sold on AliExpress for around $20.\n\nThis repository contains Python code for talking to the cat printer over Bluetooth Low Energy (BLE). The code has been reverse engineered from the [official Android app](https://play.google.com/store/apps/details?id=com.frogtosea.iprint\u0026hl=en_US\u0026gl=US).\n\n# Installation\n```bash\n# Clone the repository.\n$ git clone git@github.com:rbaron/catprinter.git\n$ cd catprinter\n# Create a virtualenv on venv/ and activate it.\n$ virtualenv --python=python3 venv\n$ source venv/bin/activate\n# Install requirements from requirements.txt.\n$ pip install -r requirements.txt\n```\n\n# Usage\n```bash\n$ ./print.py --help\nusage: print.py [-h] [-l {debug,info,warn,error}] [-b {mean-threshold,floyd-steinberg,atkinson,halftone,none}] [-s] [-d DEVICE] [-e ENERGY]\n                filename\n\nprints an image on your cat thermal printer\n\npositional arguments:\n  filename\n\noptions:\n  -h, --help            show this help message and exit\n  -l {debug,info,warn,error}, --log-level {debug,info,warn,error}\n  -b {mean-threshold,floyd-steinberg,atkinson,halftone,none}, --img-binarization-algo {mean-threshold,floyd-steinberg,atkinson,halftone,none}\n                        Which image binarization algorithm to use. If 'none' is used, no binarization will be used. In this case the image has to\n                        have a width of 384 px.\n  -s, --show-preview    If set, displays the final image and asks the user for confirmation before printing.\n  -d DEVICE, --device DEVICE\n                        The printer's Bluetooth Low Energy (BLE) address (MAC address on Linux; UUID on macOS) or advertisement name (e.g.:\n                        \"GT01\", \"GB02\", \"GB03\"). If omitted, the the script will try to auto discover the printer based on its advertised BLE\n                        services.\n  -e ENERGY, --energy ENERGY\n                        Thermal energy. Between 0x0000 (light) and 0xffff (darker, default).\n```\n\n# Example\n```bash\n% ./print.py --show-preview test.png\n⏳ Applying Floyd-Steinberg dithering to image...\n✅ Done.\nℹ️ Displaying preview.\n🤔 Go ahead with print? [Y/n]?\n✅ Read image: (42, 384) (h, w) pixels\n✅ Generated BLE commands: 2353 bytes\n⏳ Looking for a BLE device named GT01...\n✅ Got it. Address: 09480C21-65B5-477B-B475-C797CD0D6B1C: GT01\n⏳ Connecting to 09480C21-65B5-477B-B475-C797CD0D6B1C: GT01...\n✅ Connected: True; MTU: 104\n⏳ Sending 2353 bytes of data in chunks of 101 bytes...\n✅ Done.\n```\n\n\n# Different Algorithms\n\n**Mean Threshold:**\n\n![Mean threshold](./media/grumpymeanthreshold.png)\n\n\n**Floyd Steinberg (default):**\n\n![Floyd Steinberg](./media/grumpyfloydsteinbergexample.png)\n\n**Atkinson:**\n\n![Atkinson](./media/grumpyatkinsonexample.png)\n\n**Halftone dithering:**\n\n![Halftone](./media/grumpyhalftone.png)\n\n**None (image must be 384px wide):**\n\n![None](./media/grumpynone.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbaron%2Fcatprinter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frbaron%2Fcatprinter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbaron%2Fcatprinter/lists"}