VT330/VT340 Sixel Graphics
vt100.net
vt100.net
Some terminal implement some other protocols, but attempts to specify a standard have failed. There are some tricky issues, such as: When does an image or part of an image get erased? Can you write text on top of an image and if so how are they aligned? What happens if you write an image on top of existing text? On top of an existing image? How does scrolling affect things? What happens to the image on window resize or zoom? Can you reliably update part of an image?
DomTerm (https://domterm.org) supports images in two ways: For sixels, it creates a canvas element as an "underlay". As it is earlier in he rendering order, following text can be written on top of the image.
DomTerm also supports general HTML, including IMG elements. (Of course it is safety-scrubbed.) This is quite flexible, but it doesn't overlap regular text (without some contortions). DomTerm allows different lines to have different height, which is beneficial for "printing" an image without having to pad the output to an integral number of rows.
Neither of these DomTerm protocls are suitable for a portable protocol that can be widely implemented. Two other protocols that I'm aware of are the iTerm2 protocol and the Kitty protocol. Both are bit on the complicated side, but a subset of one of those might be an acceptable "standard".
I know word perfect for Unix used it for the print preview but I don't know any other app from those days that used them at all. The same with the double width or height fonts the VT series offers. I've only ever seen them working when running vttest. They could be very useful, but in practice I've never seen them actually used for something other than testing.
These days with pretty much unlimited speed sixels actually become useful. But they don't support full 24 bit colour so another technique is probably better for today's needs. For example it would be great to be able to define a terminal region and send images and video to it with full hardware acceleration and compression (H.264 or similar). I think there's still a good usecase for terminals, but holding on to sixel feels a bit too much of a kludge to me. If they were super abundant and popular, sure. But they never actually were.
I think this is also why kitty chose to build a custom protocol instead of implementing sixel.
I just myself wrote a pseudo-window login dialogue (a replacement for the login(1) program for framebuffer terminal emulators that can do Unicode) using MouseText from the Apple IIc, which got added to Unicode version 13 in 2020.
But unicode support is pretty ubiquitous now. It works great. Despite advanced unicode (ligatures, emoji) not really playing nice with monospaced fonts, most terminals handle it very well.
Though more and more console libraries are supporting multiples of these which will help get more reach for all of them.
they were novel but they weren't actually good. that goes double for sixel: it was pretty cool to see the system manager loading a color image on his vt340+ but we're talking about a postage stamp per second. you could see the individual color planes loading
the vt340 was a misguided engineering dead end. i think even the vt100 was a mistake, given that they had to put an entire computer inside of it to make it work, and it would have been a lot nicer to rethink how terminals could work in light of the new possibilities opened up by vlsi
which, of course, is how we got not just supdup but the apple ][, the commodore 64, the hp-41c, the macintosh, lantastic, netware, doom, etc.
Yeah that was my point. It was so slow it was really only usable for the usecases bringing extreme value. A vector drawing protocol like tectronix (still included in xterm also) would have been preferable.
> the vt340 was a misguided engineering dead end. i think even the vt100 was a mistake, given that they had to put an entire computer inside of it to make it work, and it would have been a lot nicer to rethink how terminals could work in light of the new possibilities opened up by vlsi
The VT340 yes. I don't think the VT100 was a dead-end. It wasn't the most popular terminal of its day for nothing. This was the time when microprocessors started powering everything from microwaves to fridges. A "whole computer" was still simpler than the VT05 which had no "computer" but a whole stack of PCBs full of discrete electronics.
See how horribly deep it was to house all those electronics: http://terminals-wiki.org/wiki/index.php/File:DEC_VT05_12170... . And despite all that its terminal protocol was super basic, it wasn't a lot more than a screen-based teletype. I think it's one of the most beautiful designs of the day though. Very star trek.
The VT100 was a computer yes (there was actually a standalone CP/M version of it called the VT180). But it didn't really compete with PCs, it was a logical choice if you had a centralised minicomputer which was still very common back then. Being 'cheap' was relative only to the central computer which was a huge investment.
And of course its successors were way cheaper and smaller (the VT220 and VT320 in particular). I think the 320 was a really nice form factor, the 220 still had fairly chunky bezels.
I still own a VT520 myself but it has a distinct "generic VGA monitor" feel. It is the most capable of the range for using it in this day and age though (which doesn't mean a lot, a lot of *nix software these days just blasts xterm without bothering to check termcap or terminfo).
the vt100 was a computer cosplaying a decscope, plus other escape sequences, but you couldn't program it. that's why i said it was a mistake, even though it clearly wasn't a dead end. even the vt52 was microprogrammed, but its microprogram state machine was too dumb to do much even if it could have stored a program
once your terminal wasn't dumb anymore there was a lot you could do with graphics that wasn't really feasible with even a vt340
aside from games, i mean. desktop publishing, pixel painting, autocad, spreadsheets with plotting, schematic capture
ram was a big limitation; you could imagine a bitmapped terminal whose text capability was similar to the decscope (12 lines of 80 characters, originally: 400 pixels horizontally by 96 pixels vertically gives you 38400 pixels, 4800 bytes of vram) but afaik nobody built one until 90s cellphones. all the bitmapped terminals i've heard of from the vt100 epoch were minimally 2.5 times that size, requiring 12 kilobytes of ram, which in the 01970s was quite a chunk of change. the adm3a or similar only required 2k
the vt100 supposedly had 3k, but without the extra-cost avo option it didn't support 132-column mode, except with a reduced line count
a lot of video games made do with less storage than that by virtue of tile/sprite hardware, basically character generators. a hypothetical smart terminal that never existed with 3300 bytes of memory could have used 2000 bytes for 25 rows of 80 characters onscreen, with the remaining 1044 bytes divided between 5x8 softfont glyphs (at most 160 of them), event and timer handlers written in a stack language (at most 1044 1-byte instructions), and state for those programs
that would enable things like local editing, a popup calculator, command line history, multi-frequency beeps, and copy and paste (though, probably, not all at once). i think that would have been cheaper and immensely more functional than the giant rom program full of fixed-function escape sequences that the vt100 in fact had
but that's with the benefit of 45 years of hindsight. more interesting to me is the question of what similar huge opportunities we're missing out on today by unthinkingly continuing to adapt our systems to technical limitations that no longer exist
not work for you?
I found it for Ubuntu, Fedora, Alpine, Arch, and Gentoo - the first two make extending availability elsewhere pretty simple.
The specs covering the package managers for most derivatives are already written
No, I'm just asking why there's interest around Sixel when there are protocols (like iTerm's Inline Images Protocol) that use standards-based image formats.
I'm not a heavy terminal user and don't see much value for images in my CLI, so one very possible explanation is that I don't understand the use cases where this "interesting" format (without a guaranteed pixel aspect ratio, as I understand it) shines.
Edit:
(a) The VT240 (1984) did do sixels (§4.18.1 of VT240 Series Programmer Reference Manual).
(b) xterm didn't add it until 2013. Maybe I was thinking of dxterm? Now I have to look that up.
Edit 2: I was almost certainly thinking of dxterm. I can't find a specific reference for the Ultrix version (which I had used) but the VMS version (which I didn't) had sixel support circa 1990.
was that for images tho or just softfonts
(I remember the hype, but it was before my working life. I have a Telidon keypad in my hoard, though.)
Thanks for the correction about xterm, BTW. I think I believed, until yesterday, that dxterm was an xterm derivative.
I would welcome a proper pixel graphics / framebuffer standard for terminals though.
Unfortunately iTerm's method does not have a googlable name like ‘sixel’.
- It required special expensive terminals, the VT330 (mono) or VT340. Those were not ubiquitous, the VT320 was the bread and butter type. Later VTx20 models also didn't gain support for it (usually the lower range models got premium features from the previous ranges like multiple connections / pages but this one didn't 'trickle down'). So there wasn't so much incentive for developers to support it as the installed base was very low.
- It required a long time to send all the information, because terminals were still on slow serial connections. The VT320 could only do up to 19200 bps which was not even super fast for text at 80x25! Sixel images would take ages to transfer. Even though we had different expectations of response speeds then, sixels were slow by the standard of the day.
- Colour highlighting (or even monochrome "bold"/ultrabright) was not even common in most commandline tools back then, even LS. Hell, on HP-UX in the 90s I couldn't even use the cursor keys in the default shell for command history and line editing! Mod cons we take for granted now were yet to be invented then.
- Thumbnail processing as the parent suggests would take a lot of space and processing speed. My quota at college was a few megabytes. In fact I hardly had any images. I think I had just one, a nice Enterprise-D render that I used as wallpaper. It's not like we had thousands of images to sift through like we do today. Of course the web changed that rapidly but at that time text terminals were already on the way out.
Some apps used it for stuff that was worth the wait. Like the print preview in word perfect. But many apps didn't bother because the above constraints just made them infeasible. Sixels only really took off after their original terminals were long gone. And really in this day and age we should be able to come up with something better.
now, if you want to display graphics from a remote server, your choices include webp over quic, jpeg over http, and h.264 over ssh, and raw pixels over x11, possibly lz77-compressed by forwarding over ssh -XC
sixel is an obviously terrible choice compared to any of those except that it forms part of your shell window, which is a pretty big plus; but i agree with you that in this day and age we should be able to come up with something better
It was just something dependent on a core choice of what kind of computing you wanted in your business (centralised minicomputer or distributed with PCs)
The applications those ran were also not compatible at all.
and then you could also use the pc for some other things, like it could edit a text file more responsively, and without causing context switches on your vax and slowing it down for other users. even if moving the files back and forth over kermit was a bit of a pain, and the keybindings for tpu or edt weren't compatible with wordstar or brief or whatever you used on the pc
but yeah once you had pcs there was a strong temptation to move most of the computing onto them unless it wouldn't fit, even though prodos, ms-dos, system 7, etc., were diarrhea pie
If I want to show a single picture, it doesn't take longer to type eog <filename> [1] than my alias (icat), if I need to see thumbnails of more than one, it doesn't take longer to open my file manager. If the file is remote, the directory is mounted easily from my file manager or the command line.
[1] eye of gnome in my case
I guess most people who are afraid to get out of the terminal are those that are stuck with terrible window managers from macOS or Windows and don't know how to easily switch focus from one window to another and back in a pinch without using their mouse.
I use both GUI and Terminal yes (KDE though because I hate Gnome's opinionated design :). I can control it fully with the keyboard but on a remote system I'd still prefer to do things inside the ssh session. Usually because I've jumped through different systems and forwarding it the whole way is a PITA. I never really use sshfs for this reason.
In fact no I rarely need to view pics either, it's just not really one of the things I would do on remote systems. But it's nice to have the ability if the need does arise.
https://www.youtube.com/watch?v=sL_FfWK6J2w
it'd be nice to have that when i'm sshing to a remote machine but without jupyter's janky scrolling
https://github.com/joouha/euporie
I don't support audio yet, but it should be possible using DECPS escape sequences
what do you think of the prospects for supporting smooth animation or mouse interaction with data visualizations? e.g., brushing or interactive rotation in 3d. in https://news.ycombinator.com/item?id=35951674 i was claiming that that isn't feasible within the constraints of extended vt100 emulation, but i'd love to be proven wrong
i'm also curious how kitty's protocol deals with unexpected output from a background process interleaved in the middle of an image
We could build some pretty nice GUIs in the terminal maybe ;)
excerpt from my comments yesterday at https://news.ycombinator.com/item?id=35940188:
> some technologies, like the unix shell, smalltalk, and tcp/ip, make hard things easy and easy things possible. others, like retrocomputing, code golf, and malbolge, make easy things hard and hard things impossible. sixel makes easy things hard and hard things impossible, ....
> that's a fun way to spend my time when i choose to (e.g., in https://asciinema.org/a/390271 i did real-time 3d graphics in a unicode terminal emulator with braille) but it's not how i want my primary user interface to my computer to work ...
> sixel is oulipo programming; encoding your graphics in sixel is like writing a novel without the letter 'e'. btw, a wonderful article about oulipo programming is https://100r.co/site/working_offgrid_efficiently.html
> sixel is an art project, not an engineering project
Is there a better alternative for pixel graphics in the terminal? If yes I'm all ears. The way Sixels encodes pixel data sucks, but currently it seems to be the only way to render pixels in the terminal (and that's implemented in more than one terminal application).
but i've used graphical terminals like ncd x terminals since 01994, and they provided smooth graphical interactions even over shared 10-megabit ethernet. current xorg and xwayland do a great job of emulating those terminals, with most of their deficiencies fixed, and ssh has built-in support for transparently passing along the needed credentials
xpra works even better, supporting h.264 compression and reattaching to applications you've detached from
the big problem with x11 is that trying to write a program to do something simple like display an image or draw a bar graph ensnares you in five pages of bureaucracy
to solve that problem i wrote yeso: https://gitlab.com/kragen/bubbleos/blob/master/yeso
here's a program to display a png with yeso:
#include <yeso.h>
int main(int argc, char **argv)
{
ypic img = yp_read_png(argv[1]);
if (!img.p) return 1;
ywin w = yw_open(argv[1], img.size, "");
yp_copy(yw_frame(w), img);
yw_flip(w);
for (;;) yw_wait(w, 0);
}
it also runs on the linux framebuffer without x-windowshere's a color generalization of munching squares in yeso in python:
import yeso
def munch(t, fb):
for y, p in enumerate(fb):
for x in range(fb.size.x):
p[x] = (t & 1023) - ((x ^ y) & 1023)
if __name__ == '__main__':
with yeso.Window(u"CPython μunching", (256, 128)) as w:
t = 0
while True:
with w.frame() as fb:
munch(t, fb)
t += 1
it uses python context managers so you don't forget to yw_flip()there's also a luajit binding
the example programs above are non-interactive, like virtually everything sixel that isn't full-screen; here's a lua program to test mouse interaction:
local yeso = require 'yeso'
function bounds(a, b)
if a < b then return a, b else return b, a end
end
yeso.Window("mΩuso", {256, 256}):run(function (w)
local m, dragStart = {x=128, y=128}
while true do
for ev in w:events() do
if ev.isMouse then
m = ev.p
if ev:button(1) and dragStart == nil then
dragStart = {x=ev.p.x, y=ev.p.y}
elseif not ev:button(1) then
dragStart = nil
end
end
end
w:frame(function (f)
f:fill(0x7f7f7f)
if dragStart then
local minX, maxX = bounds(dragStart.x, m.x)
local minY, maxY = bounds(dragStart.y, m.y)
f:sub({minX, minY}, {maxX-minX, maxY-minY}):fill(0x336699)
end
end)
w:wait()
end
end)
as for embedding interactive graphics in a text stream, i'm still trying to figure out the bubbleos solution to that. but i'll get there, and the result will be usable over ssh, while sixel probably hasn't gotten there even for low-bandwidth interactive localhost cases and probably never willThe problem is that with the predominance of toolkits like GTK & Qt in the *nix application space, which pre-rasterize everything for easier cross-platform compatibility, X forwarding is nowhere near as efficient as it once was. Under present circumstances, the h.264 route is probably as good as it gets.
https://techcommunity.microsoft.com/t5/security-compliance-a...
looks like you're right:
> With RDP 8.1 we introduced an AVC/H.264 mixed mode which in addition to using RemoteFX Media Streaming, extended support for AVC/H.264 to images as well, while text is compressed using a proprietary Codec. This mode is used by Windows RT devices running Windows 8.1 and some 3 rd party RDP implementations.
motif is not quite as bad, hiding some of the worst parts of xt, but it's still unnecessarily clumsy
unfortunately, unlike sixel, there's already enough software written that depends on them that we have to keep supporting them
how about the opposite
Also, I'm curious what you think of Arcan (https://arcan-fe.com)
was it you that linked me to arcan the other day? i've been studying it. i think it's interesting
You can do all kinds of things to make something better, but the two things that matters for this usecase is being able to do it over ssh and wide enough support that you can start relying on it. Better performance or more features only matters if both of those are met.
i think the problem here is that x11 is shitty at 'inline' (things tend to open annoying new windows) and a modern terminal cosplaying a vt100 is shitty at graphics
sixel doesn't solve that problem; your terminal emulator is still shitty at graphics
Just something that's marginally better than emulating bitmaps with unicode characters is sufficient, as long as it's inline and simple to output.
(you do have to worry about bugs in yeso, of which there are several)
if you don't like c, in cpython it's four lines of code with yeso
from yeso import *
w = Window('hello, world', (406, 220))
w.frame().copy(read_png('admu_shell.png'))
while True: w.wait()
this requires a little bit of tweaking to work in pypyalso it works on the linux framebuffer as well as in x-windows
not being inline is a harder problem to solve
Not needing to pull in a dependency also matters. E.g. this is enough to do Sixel on a supporting terminal:
echo 'G1BxIzA7MjswOzA7MCMxOzI7MTAwOzEwMDswIzI7MjswOzEwMDswIzF+fkBAdnZAQH5+QEB+fiQjMj8/fX1HR319Pz99fT8/LSMxITE0QBtcCg==' | base64 -d
Or e.g (I have no idea if this will survive HN's comment parsing, but it's the output of base64 decoding the above in single quotes): printf '\ePq#0;2;0;0;0#1;2;100;100;0#2;2;0;100;0#1~~@@vv@@~~@@~~$#2??}}GG}}??}}??-#1!14@\e\\\n'
Having other options is great, but then don't remove the desire to have something really basic as well.i think you could probably get pretty far by creating a new x11 socket with fresh xauth for each new program launched; then, instead of opening new floating overlapping windows for them, embedding the display of whatever windows they create in your notebook, just below below the command that created them
a bytestream protocol has some real advantages, including being able to forward it over a network socket, including an ssh-forwarded socket, or providing a gui for whatever little embedded electronic gadget you build and connect to your terminal over spi or usb serial
i had previously rejected it as too inefficient for the localhost use case, but in https://news.ycombinator.com/item?id=35693474, and some later protocol-design ideas i haven't shared yet, i convinced myself that you can probably make it efficient enough for anything that doesn't use custom shaders
is this something you'd be interested in talking about in a less hostile environment
unless you ran across the pobox address, which has been dead for... a while
the canonical.org address is the correct one
comment if you've emailed me and not gotten a response
https://github.com/saitoha/libsixel
Plenty of links to other projects.
Is that just uninteresting to people that might want to use it?