Skip to main content

kittytgp

kittytgp is a small pure-Python package that renders a PNG with kitty's graphics protocol using Unicode placeholders (U+10EEEE).

It follows kitty's tmux/editor-friendly placeholder flow:

  1. transmit PNG data with kitty graphics protocol
  2. create a virtual placement with U=1
  3. print U+10EEEE placeholder text colored with the image ID

Because the visible part is ordinary Unicode text, the image moves with the text buffer and works inside hosts such as tmux.

Install

pip install kittytgp

CLI

kittytgp plot.png

Useful options:

kittytgp plot.png --cols 40
kittytgp plot.png --rows 20
kittytgp plot.png --cell-size 10x20
kittytgp plot.png --image-id 0x123456
kittytgp plot.png --no-newline

Python API

from kittytgp import render_png

render_png("plot.png")

Or build the bytes yourself:

from kittytgp import build_render_bytes

payload = build_render_bytes("plot.png")

An app that draws its own screen can size the image and place each part itself. png_size reads a PNG's size in pixels. fit_grid chooses the largest grid within a column budget that keeps the image's aspect ratio, and consults no terminal. render_parts returns the transmit bytes and the placeholder text separately:

from kittytgp import png_size, fit_grid, render_parts

w, h = png_size("plot.png")
cols, rows = fit_grid(w, h, max_cols=40)
transmit, placeholder = render_parts("plot.png", cols=cols, rows=rows)

Design notes

This package intentionally stays small:

  • PNG input only
  • direct transfer (f=100 PNG payload in APC chunks)
  • Unicode placeholders only
  • 24-bit image IDs encoded in truecolor foreground color
  • tmux passthrough only when needed

By default it fits the image into the current terminal while preserving aspect ratio. If the terminal cannot report cell pixel size, pass --cell-size, --cols, or --rows.

Metadata

Release files for kittytgp 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kittytgp 0.0.3
File Size Uploaded
kittytgp-0.0.3.tar.gz 18.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kittytgp 0.0.3
File Interpreter ABI Platform
kittytgp-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 35.2 kB

Release files / kittytgp-0.0.3.tar.gz

Download URL kittytgp-0.0.3.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2535930faca969f5dff078a9a3cd5b0cc1c2704491c0c0d39c21ab2decbe1a3a
BLAKE2b-256 checksum
How to use checksums
15bae5d691ee67e5142fbe921961aab4eb317264b45b1a1952315fc5b793d112
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / kittytgp-0.0.3-py3-none-any.whl

Download URL kittytgp-0.0.3-py3-none-any.whl
Size 16.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
906511c6f9b58eaf7bc8647904ad13b0a62d35e2adbddf0a05434c9c5469b867
BLAKE2b-256 checksum
How to use checksums
20edfd5d3b3362cc0479d3d3c1c2ee2fad6fb13b92aae130bd1100dd78386c2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page