13

Can I see images and watch movies inside the terminal emulator? In case of virtual console I can do it via framebuffer, but what about terminal emulators?

5

A number of terminal emulators support Sixel Graphics, from the PySixel github page, the list is:

  • RLogin
  • tanasinn
  • mlterm
  • XTerm
  • DECterm
  • Kermit
  • WRQ Reflection
  • ZSTEM

You can display the images with the afore mentioned PySixel, which seems to be able to do the necessary conversions. Another option is to use tools from netpbm. I had good results using the following to convert and display a JPEG image on mlterm:

jpegtopnm image.jpg | pnmquant 256 | ppmtosixel >/dev/tty

Result:

mlterm displaying Sixel picture

XTerm can also display Sixel images, though support is currently limited to 16 colours (and is also buggy). An archive containing sample images can be downloaded here, though the scripts seem to be broken. XTerm doesn't display the exact format output by ppmtosixel (it doesn't support the control sequences used at the start/end). Before finding PySixel, I used the following scrip to hack the ppmtosixel output into something XTerm will display:

#!/bin/bash

echo -e '\eP0;0;0;q"1;2;400;400'
jpegtopnm "$1" |
  pnmquant 16 |
  ppmtosixel |
  tail -n +2 | 
  head -c -3
echo -e '\x1b\x5c\x0d'
tput cup "$(tput lines)" 0

The images won't be displayed in the default VT420 mode. Only in VT240, VT241, VT330 or VT340 modes will they be displayed. Also the --enable-sixel-graphics build option is required. I found best results with VT340 (xterm -ti vt340). Here are the results (the first is a very cool tron image from the sample archive):

enter image description here

  • 1
    Your script is not exactly robust with the echos and head and tail. The issue that you are trying to fight is that xterm in utf8 mode has problems with 8bit c1 codes. Fortunately c1 codes can also be 7bit encoded. perl -wpe 'use bytes;s!([\x80-\x9f])!qq(\e).chr(ord($1)-64)!ge' works as a great filter after ppmtosixel (and any other times you want to switch 8bit c1 codes to their 7bit equivalents). – hildred Aug 1 '15 at 6:45
  • Is there anything like this for konsole or other modern terminal emulators? – ctrl-alt-delor Apr 1 '16 at 21:11
5

Terminology

is what you want.

For instance - I want to change the background of my terminal?

printf '\033}bp%s\000' \
  'http://hdwalldesktops.com/wp-content/uploads/2014/02/background-backgrounds-high-resolution-abstract-picture-background-wallpaper.jpg'

What does it do?

It emulates a slightly extended vt100 with some extensions and bling thrown in.

> Most escapes supported by xterm, rxvt etc. work

> Xterm 256 color escapes work

> Backgrounds (bitmap, scalable/vector, animated gif, videos)

> Transparency

> Bitmap and scalable fonts supported

> Themes for the layout and design

> URL, file path and email address detection and link-handling

> Inline display of link content

> Multiple copy and paste selections and buffer support

> Works in X11

> Works in Wayland

> Works directly in the linux framebuffer (fbcon)

> Can be finger/touch controlled

> Scan scale by UI scaling factors

> Can render using OpenGL or OpenGL-ES2 (not a requirement - just an 
option)

> Can display inlined media content (images, video, documents)

> Can do multiple "tabs"

> Can do splitting into multiple panes

> Block text selection

> Drag and drop of text selections and links

> Can stream media from URLs

> Tab switcher has live thumbnail content

> Single process, multiple windows/terminals support

> Fast (gives urxvt a run for its money)

> Themable visual bell

> Compress backscroll

> Text reflow on resize

> Color palette selection

> More...

You see that above? It does this in the framebuffer.

2

I recently discovered Frame Buffer Image viewer, fbi.

1

Yes, sort of. Mplayer, for example, supports both aalib (monochrome) and libcaca (color) rendering of video in a text terminal. It's not exactly high-resolution, but with both sub-"pixel" rendering and temporal dithering increasing the effective resolution, you can usually tell what's going on.

0

In the Unix world terminal emulators emulate serial terminals, where the data stream to be shown to the user is sent one at a time over a serial line.

In the modem time this was typically around 1000-2000 characters a second, but may be much faster today if only emulated hardware is involved. It was then up to the terminal to understand the bytes sent. Usually this was for showing characters, moving the cursor and manipulating the screen display. A few terminals could switch to graphics modes - gnuplot support quite a bit - but the bandwidth is much too small to do anything interesting in terms of video.

Still, for a modern computer with emulated hardware a terminal emulator can do quite a lot. Try searching for images with the search term "ttyquake" to see some of then. I would say though that if you crave HD you will most likely be disappointed.

http://onyx.chattanoogastate.edu/~jack/matrix/insert.jpg

  • Note that some terminal emulators may provide vendor specific extensions. – Thorbjørn Ravn Andersen Apr 8 '14 at 5:18
0

For image viewing, go for fim

For Video playback option, use mplayer

EDIT:

Rather fim, try picture-tube. Though I have not tested it yet

  • This is for the Linux Console framebuffer, not a terminal emulator. – Graeme Apr 8 '14 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.