main ab6686c

graphics.md RawHistoryFolder

Terminal images

Back to the README

vev-vt supports a subset of the Kitty graphics protocol for static images sent directly through terminal output, including the form used by:

kitten icat --transfer-mode=stream image.png

Your application reads the result through Screen.GraphicsSnapshot() and chooses how to display it. This library does not open a window.

Supported

  • PNG, RGB and RGBA images, with explicit resource limits.
  • Direct image transmission, display, placement, queries and supported deletion.
  • Chunked Base64 data, with optional zlib compression.
  • Cropping, cell-based placement, pixel offsets and z-index.
  • Placements with only c= or only r= keep the displayed region's aspect ratio: the other value is the rounded-up size derived from the cell pixel size (1:2 width:height when the screen pixel size is unknown), at least 1. c=0 and r=0 mean unset.
  • Movement and clipping as terminal rows scroll.

Images are stored separately from text history. The graphics package contains the image model; protocol/kittygraphics reads Kitty commands and updates it. Graphics state is allocated only when a screen receives a graphics command.

Not supported

File or shared-memory transfers, animation, image composition, relative placements and Unicode placeholders are not implemented. Image placements do not support resize reflow.

Inspect a capture without a display

The development harness reads captured terminal bytes and writes a PNG:

go run ./cmd/graphics-harness \
  -input internal/graphicsharness/testdata/demo.apc \
  -output /tmp/graphics-harness.png \
  -cols 4 -rows 4 -pixel-width 4 -pixel-height 4 -scale 64

The included example produces a blue background with a translucent red overlay. This harness is an inspection tool, not an interactive terminal emulator.

source
1# Terminal images
2
3[Back to the README](../README.md)
4
5vev-vt supports a subset of the Kitty graphics protocol for static images sent
6directly through terminal output, including the form used by:
7
8```sh
9kitten icat --transfer-mode=stream image.png
10```
11
12Your application reads the result through `Screen.GraphicsSnapshot()` and chooses
13how to display it. This library does not open a window.
14
15## Supported
16
17- PNG, RGB and RGBA images, with explicit resource limits.
18- Direct image transmission, display, placement, queries and supported deletion.
19- Chunked Base64 data, with optional zlib compression.
20- Cropping, cell-based placement, pixel offsets and z-index.
21- Placements with only `c=` or only `r=` keep the displayed region's aspect
22  ratio: the other value is the rounded-up size derived from the cell pixel
23  size (1:2 width:height when the screen pixel size is unknown), at least 1.
24  `c=0` and `r=0` mean unset.
25- Movement and clipping as terminal rows scroll.
26
27Images are stored separately from text history. The `graphics` package contains
28the image model; `protocol/kittygraphics` reads Kitty commands and updates it.
29Graphics state is allocated only when a screen receives a graphics command.
30
31## Not supported
32
33File or shared-memory transfers, animation, image composition, relative
34placements and Unicode placeholders are not implemented. Image placements do
35not support resize reflow.
36
37## Inspect a capture without a display
38
39The development harness reads captured terminal bytes and writes a PNG:
40
41```sh
42go run ./cmd/graphics-harness \
43  -input internal/graphicsharness/testdata/demo.apc \
44  -output /tmp/graphics-harness.png \
45  -cols 4 -rows 4 -pixel-width 4 -pixel-height 4 -scale 64
46```
47
48The included example produces a blue background with a translucent red overlay.
49This harness is an inspection tool, not an interactive terminal emulator.

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 2

Tags 13

↑↓ moveenter openesc close