How many competing protocols are there for displaying images in a terminal? There's this, iTerm2 (also supported by Secure Shell[1])... any others? We need one unified standard[2] for graphics in terminal emulators!
I’ll bite. No other platform has the same level of integration and tool quality. There is no real remplacement for iTerm and Preview. There is no real equivalent of air drop, handoff (copy paste, pulling OTPs from sms, scan through phone...). TouchId that works, unlock with watch. For people in the Apple ecosystem the competition would have to get a lot better and the iOS/macOS a lot worse to be worth a switch.
Eh. Haven't used Windows in 15 years and don't intend to in the future either. Linux would require a whole lot of fiddling (if I'd even managed to find a laptop with good hardware and hardware support to begin with). Macs have excellent hardware (yes you pay a premium for it). Good battery life. Good keyboard (up to 2015 models at least). Great touch pad (hardware and driver wise). MacOS has a good window manager, excellent applications like iTerm2 and Alfred that I wouldn't want to live without and would have to find subpar Linux replacements for. This sucks a bit since I've generally tried to keep to cross-platform apps and because of these I'm a bit locked in.
Oh and the consistent keyboard shortcuts across the OS (terminal included) with Cmd is soooo nice.
That said I'm using 2015 models (Air and Pro) as the newer ones haven't impressed me at all (had an MBP with touch bar for a year or so). Love the Magsafe power connector (which just gracefully disconnects when you rough it) and don't want to switch to USB-C and its adapter hell.
Once it's no longer possible to find proper 2015's anymore I might want/have to consider switching back to Linux (and spend a lot of time fiddling with everything), but we're far from there still - I recently bought a 2015 MBP with new battery for €800.
Edit: Unlike one other poster here I loathe iOS and think it's horrible (had an iPhone for a year so have some hands on experience) so I don't use features like AirDrop or handoff (even though it's super convenient between two Macs). And he mentions Touch ID which was actually brilliantly convenient on the newer MBP I had, but that's not unique to Macs. So yeah, the more you lock yourself into the Apple ecosystem the more benefits you get, but I've tried to explicitly not do that.
If we finally (at 2020) get some sort of stable image capability to the terminal, we can start to have a lot of charting or other creative capabilities incorporated into CLI tools instead of the ancient way of drawing by characters.
Is there a reason why the terminals aren't evolving toward that way?
I don't understand it. It appears to split pixels in two (check the special unicode ascii art character on line 142[0]), not in four as the screenshot would suggest. Is that special character half-width in certain terminals, or something?
EDIT: ahhh I got it! Before this commit, they printed out two spaces for a single pixel to closer resemble a square, because most terminal fonts are much taller than they're wide. They replaced that by a single character that has one color in the top half and one color in the bottom half. Each of those halves, again, are almost square (HN doesn't let me display the character here, it filters out certain unicode ranges)
what I mean is I don't understand why the post is significant.
This is something I'd expect to see done by just about anybody along with the full 8th blocks https://en.m.wikipedia.org/wiki/Block_Elements on literally the first day or two of starting this kind of project.
I like positive open source threads sure, but is that what this is about or is there some extraordinary technical details I'm not seeing?
Examples of people being nice to each other in FLOSS projects is certainly something we could always use more of, sure. Is that what this is?
It's interesting to see forgotten lore or techniques reemerge. We (Charm) have just published a TUI framework called Bubble Tea and imgcat was one of the first tools that implemented it, so we were excited to see the progress and help with rendering.
If you want to further add vertical resolution, Unicode 13 introduces 2x3 mosaics (from the TRS-80, Teletext and others) that are supported directly within VTE (so people don't need to install a font). Slightly more complicated are the "smoothed" mosaics (from Minitel 2, IIRC) but they offer diagonal lines (and complement PETSCII and ATASCII symbols also introduced in version 13).
I expect 2x4's to be available for version 14, but it'll be a while.
2x3's (and 2x4's) are kind of funny, because you still won't be able to use more than 2 colors per cell, so it works for cells with two colors but that can be subdivided in thirds (or quarters). Finding a best fit for a cell and a mosaic is not a trivial job.
It's a shame support is relatively limited. Apple's Terminal doesn't (even though it passes the VT-100 torture test, which is, in itself, remarkable), nor does the VTE-based ones common in other unixes.
Symbols for Legacy Computing
(Range: 1FB00–1FBFF) would be a helpful block to look at as a possible optional even-higher-fidelity mode. Has all kinds of slopes that you could better approximate edges with.
You could probably solve for it efficiently by computing a small Histogram of Oriented Gradients block, say 3x3, and use that as a hashmap key. Or Sobel filters might be even easier.
I use a shell script from Gnome's Virtual Terminal codebase, which seems to do more-or-less the same thing, and has used these two Unicode characters for at least 6 years:
Reminds me that templeOS did bring something interesting to the table that we could probably learn from.. Why shouldn't our terminals be able to show images and video.
50 comments
[ 3.3 ms ] story [ 108 ms ] threadhttps://iterm2.com/features.html#inline-images
[1] https://chromium.googlesource.com/apps/libapps/+/HEAD/hterm/...
[2] https://xkcd.com/927/
The better answer to obvious trolling is downvoting/flagging and moving on. Feeding the troll only derails the thread.
Oh and the consistent keyboard shortcuts across the OS (terminal included) with Cmd is soooo nice.
That said I'm using 2015 models (Air and Pro) as the newer ones haven't impressed me at all (had an MBP with touch bar for a year or so). Love the Magsafe power connector (which just gracefully disconnects when you rough it) and don't want to switch to USB-C and its adapter hell.
Once it's no longer possible to find proper 2015's anymore I might want/have to consider switching back to Linux (and spend a lot of time fiddling with everything), but we're far from there still - I recently bought a 2015 MBP with new battery for €800.
Edit: Unlike one other poster here I loathe iOS and think it's horrible (had an iPhone for a year so have some hands on experience) so I don't use features like AirDrop or handoff (even though it's super convenient between two Macs). And he mentions Touch ID which was actually brilliantly convenient on the newer MBP I had, but that's not unique to Macs. So yeah, the more you lock yourself into the Apple ecosystem the more benefits you get, but I've tried to explicitly not do that.
edit: it did: two spaces here https://github.com/trashhalo/imgcat/commit/1f9ef8c888fa93e1e...
While it offers console based interactive exploration of your data you can also get it to just spit out the graph you want.
Is there a reason why the terminals aren't evolving toward that way?
It's a huge difference.
Charts, small images, interactive diagrams, flow charts etc can be more ergonomic when part of the CLI text flow than opened as a separate window.
EDIT: ahhh I got it! Before this commit, they printed out two spaces for a single pixel to closer resemble a square, because most terminal fonts are much taller than they're wide. They replaced that by a single character that has one color in the top half and one color in the bottom half. Each of those halves, again, are almost square (HN doesn't let me display the character here, it filters out certain unicode ranges)
[0] https://github.com/trashhalo/imgcat/commit/1f9ef8c888fa93e1e...
You've just got to think of and apply them in the right context.
Most of the world's major breakthroughs are basically just this.
This is something I'd expect to see done by just about anybody along with the full 8th blocks https://en.m.wikipedia.org/wiki/Block_Elements on literally the first day or two of starting this kind of project.
I like positive open source threads sure, but is that what this is about or is there some extraordinary technical details I'm not seeing?
Examples of people being nice to each other in FLOSS projects is certainly something we could always use more of, sure. Is that what this is?
Yes. That's how I interpreted it, at least. (I think it's great)
https://twitter.com/charmcli/status/1320184218794795010
It's interesting to see forgotten lore or techniques reemerge. We (Charm) have just published a TUI framework called Bubble Tea and imgcat was one of the first tools that implemented it, so we were excited to see the progress and help with rendering.
https://github.com/charmbracelet/bubbletea
http://aa-project.sourceforge.net/aalib/
Things are so hard right now in the pandemic and this has given me a little virtual hug.
Big thanks to the eng team at https://charm.sh/ who wrote the terminal library I am using and showed up with prs and great ideas.
If you want to further add vertical resolution, Unicode 13 introduces 2x3 mosaics (from the TRS-80, Teletext and others) that are supported directly within VTE (so people don't need to install a font). Slightly more complicated are the "smoothed" mosaics (from Minitel 2, IIRC) but they offer diagonal lines (and complement PETSCII and ATASCII symbols also introduced in version 13).
I expect 2x4's to be available for version 14, but it'll be a while.
2x3's (and 2x4's) are kind of funny, because you still won't be able to use more than 2 colors per cell, so it works for cells with two colors but that can be subdivided in thirds (or quarters). Finding a best fit for a cell and a mosaic is not a trivial job.
https://saitoha.github.io/libsixel/
https://twitter.com/charmcli/status/1320184218794795010
https://github.com/stefanhaustein/TerminalImageViewer
https://github.com/saitoha/libsixel
You could probably solve for it efficiently by computing a small Histogram of Oriented Gradients block, say 3x3, and use that as a hashmap key. Or Sobel filters might be even easier.
It is partially done, but the remaining work requires "large amount of code".
https://github.com/torvalds/linux/commit/cec5b2a97a11ade56a7...
https://gitlab.gnome.org/GNOME/vte/blob/0.36.0/perf/img.sh
Reminds me that templeOS did bring something interesting to the table that we could probably learn from.. Why shouldn't our terminals be able to show images and video.