Show images in terminal
Sometimes it is useful to display an image or video in the terminal, for example if you are on a ssh connection.
I used to use tiv
(Link)
for this purpose, but now I've switched to timg
(Link).
Images just look better and the detection for terminal width and height works also better.
See the two example screenshots of tiv and timg in xfce4-terminal.
tiv:
timg:
As you can see, the aspect ration is off for tiv, and I had to adjust the height. It seems to use the whole width by default and ignores the height, while timg detects both, width and height, correctly.
1. Checkout sixel!
(Edit 2023-08-14)
https://www.arewesixelyet.com/#xfce-terminal
Since last week, xfce4-terminal supports the sixel format link. With it, you will finally be able to draw pixel-perfect images on the terminal. timg already supports it.
There is no release of xfce4-terminal yet, but all issues in the milestone 1.1.0 are completed, including the sixel one.
On Manjaro, I had to install vte3-git (which comes with sixel support) and xfce4-terminal-git from AUR. And of course I had to update my timg.
I'm sure this will be the defacto-standard in no time.
I now like to call timg like this:
timg --pixelation=sixel --grid=2 image.png
Update 2023-08-30: Since last week, tmux now also supports sixel: https://github.com/tmux/tmux/commit/dfbc6b1888c110cf0ade66f20188c57757ee1298
2. viu
I've replaced
It is written in Rust and comes with (experimental) sixel support.timg
by viu on my machine.
Unfortunately, sixel is still not integrated into vte3, so you would still need to build it yourself. :( See here: https://gitlab.gnome.org/GNOME/vte/-/issues/253
Update:
viu does not support exif orientation for .jpg images, so I am back to timg.
Together with the rio
terminal, it supports sixel as well.