Skip to content

Add support for graphics in terminal

Matan Ziv-Av requested to merge matan/konsole:graphics3 into master

This merge requests add support for displaying graphics inside the terminal.

The graphics display infrastructure allows adding and removing of images. Each image is anchored at the top left corner to a character cell, and may scroll when text is scrolled, including to the history buffer. Images also have a Z-coordinate, with text having Z=0, so images may be drawn above the text or below.

Three terminal commands (escape sequence) protocols may be used to display graphics:

  • sixel parsing code is based on MR !517 (closed), but using my graphics rendering. I also modified the parsing to be more compliant with the specification (from vt100.net), as well as with xterm's behavior. Imagemagick (lsix) and libsixel (mpv) work, as well as echo -e '\033Pq!255~\033\' ( from the discussion in !517 (closed)).

  • iterm2. Tested with imgcat from there and timg.

  • A protocol based on kitty graphics protocol. Animation and transfer modes other than direct are not supported. In addition to PNG, any graphics format supported by QImage.loadFromData() may be used. Tested with kitty's icat, timg, and the notcurses library (ncplayer, ncls.)

This patch should be considered experimental, but it can already be useful

Merge request reports

Loading