3 ms·
A more practical and cohesive alternative is Sixel [https://saitoha.github.io/libsixel/ https://saitoha.github.io/libsixel/], which is an in-band, escape based
by jitl 6y ago
A more practical and cohesive alternative is Sixel [https://saitoha.github.io/libsixel/ https://saitoha.github.io/libsixel/], which is an in-band, escape based image format supported by “modern” terminal emulators, like iTerm2, which also has a proprietary image format [https://iterm2.com/documentation-images.html https://iterm2.com/documentation-images.html]
I prefer in-band images because it doesn’t require complex coordination between the process that wants to display the image and other software like X11, instead the process just writes out the appropriate bytes to the TTY and they get displayed.
- enriquto 6y agoSixel is really useful, but it is not optimal in terms of color quantization and fast rendering (it is quite a pain to write a color sixel image). The world needs a hero that submits simultaneously a patch to xterm, iterm and all widely used terminals to accept decent in-band color images--using verbatim framebuffers with a tiny header.
- drran 6y agoIf you need verbatim frame buffers, VNC is good for that. Basically, you will need to integrate VNC protocol into terminal protocol.
- deleted 6y ago[deleted]
- sprash 6y agoWhy stop at images? If you go the full way and include drawing commands like those in cairo script (https://cairographics.org/manual/cairo-Script-Surfaces.html https://cairographics.org/manual/cairo-Script-Surfaces.html) you can essentially abolish any other sort of app besides the terminal. Your GUI is then simply created by writing to stdout.
- enriquto 6y ago> ... simply created by writing to stdout. Shut up and take my money! No, really, that would be awesomely cool. Having support for in-band inline images is a useful start yet. I'm not the hero the world needs, but if I had a lot of money I would surely pay proficient hackers to write that thing.
- remexre 6y agoI think once you add the user input side, you've reinvented something not unlike X-as-it-originally was, though.
- enriquto 6y ago> you've reinvented something not unlike X-as-it-originally was Sounds good to me. Technology advances by the continued reinvention of the wheel, that offers new opportunities for simplification and improvement at each iteration.
- hnlmorg 6y agoI really want to like Sixel but it's such a horrible encoding, both in terms of specification and overall image quality. I much prefer the proprietary escape sequences that base 64 encode PNG (or similar) data. Granted the base 64 encoding will add ~30% to the image size in transit but modern image formats are compressed these days (which Sixel is not) so it's not a complete loss. Plus PNG will produce better quality images. It's just a pity there isn't even a de facto standard for how to escape base 64 encoded image files. There's only 3 terminal emulators that I know of which support in-band images (Sixel aside): Kitty (not to be confused with KiTTY, a PuTTY fork), iTerm2 and Terminology. All of which have their own escape sequences. I'd built a little script which opened an image in the terminal, irrespective of which terminal emulator you ran it would render the image in the best available format (falling back to ANSI block art if nothing better was available). It was a nightmare to write because of all the different terminals doing their own things. And when this stuff doesn't work there's no clue why because in-band escape sequences aren't something that produces an error if you get something wrong. It either works or it doesn't. Then you have multiplexers like tmux that can add their own undefined behaviour to proceedings. As CLI tools go by, that was probably one of my most frustrating exercises for the least reward (I could probably count on one hand the number of times I've actually needed that script).