4 ms·
There was a neat terminal emulator he wrote that had some prefixed commands for viewing images and videos right in the window. Also, the rant linked above has
by jancsika 5y ago
There was a neat terminal emulator he wrote that had some prefixed commands for viewing images and videos right in the window.
Also, the rant linked above has some responses from the Enlightenment author on page 5 of the comments. Getting some popcorn... :)
- jart 5y agoThat's old fashioned internet drama right there. It's cool he added images and video to terminals. That's something about terminals people have been trying to change for a long time and no one's figured out how to do it yet in a way that can gain consensus. I personally find the block character workaround more exciting since it's portable, requires a small amount of algorithmic / mathematical hackery, and produces a nice retro aesthetic.
- jancsika 5y agoNot sure I understand this workaround. Can it achieve pixel-exact output? Say I want to leverage it to get inline visual output in the terminal from imagemagick. Am I getting pixel-exact output? Or am I merely imagining pixel-exact output roughly the size of the retro-styled block?
- jart 5y agoIt's pixel-exact if you use unicode half blocks but pixel-exactness is meaningless if you scale the image or video to fit it in the display. You can gain higher resolution using the unicode block elements since it effectively grants four quasi pixels with two colors, in which case you can use some kind of nearest neighbor search to figure out which combination most closely approximates the 2x2 pixel chunk of the image. Where the math gets turned up to 11 is if you limit yourself to a 256 or 8 color palette and you want to use the shade blocks to blend colors like the dos days since that's difficult to accurately model. Last time I checked the techniques based on the cielab δe or din99d are the current state of the art. Some terminals like gnome-terminal avoid it entirely by simply not displaying shade blocks at all, and instead substituting them for solid blocks where the color blending is performed naively in software.
- jancsika 5y agoLet's just assume the image fits into the terminal window without scaling. In this case are any of the techniques you describe perceptually indistinguishable from displaying the image by normal means (e.g., displaying an image that fits without scaling in my browser window)?
- jart 5y agoIt's simpler if I show you: https://justine.lol/printvideo.html https://justine.lol/printvideo.html That's how you hack a terminal to display multimedia in a portable way. Sadly most terminals can't keep up. Some like Alacritty crash with memory errors running that program. Other ways exist of hacking your way to multimedia. I've seen some people code their terminal programs to sort of hook into the X Windows server, figure out where the terminal window is, and then blit their media onto an overlay. But like I said I appreciate the retro aesthetic.
- jancsika 5y agoI feel like there must be an alternate reality where someone got a rudimentary canvas into POSIX. There are probably jet packs there, too. :)
- jart 5y agoThat would be the parallel universe in which its creator hadn't been ripped apart by regulators before they had a chance to build one. AT&T tried their best to keep it going after the settlement with System Five but they were doing it with half a brain, since the us govt ordered 50% of their lab geeks to switch jobs to the one of the baby bells.
- jancsika 5y ago"Half a brain" is a poor metaphor for "one of the most impressive collections of researchers money could ever buy, divided by two."