Hacker News new | ask | show | jobs
by none_to_remain 1375 days ago
Has anyone done anything around just ... mixing images in with the terminal output? Let's say I wanted to check if I had any old memes lying around my home directory, and have a quick look so I can decide to delete or not.

  ~$ls *{png,jpg}
  oldmeme.png 
  ~$imgcat oldmeme.png 
  /----------------\ 
  | oldmeme.png    | 
  | appears right  | 
  | here in the    | 
  | terminal       | 
  \----------------/ 
  ~$rm oldmeme.png
Terminfo man page shows some evidence of support for "bit_image" commands but none of the terminals in my terminfo files seem to have it. I have over 2000 terminfo files though, I like the idea that if I found some literal teletypewriter from 1973 and figured out some way to hook it up, I am probably prepared with the proper escape sequences.
5 comments

When I first installed viu[0], I did not think I'd be using it as much as I use it today.

PS: I use nnn[1] with the preview plugin which make use cases like yours very easy to solve.

0: https://github.com/atanunq/viu

1: https://github.com/jarun/nnn

Terminology can display images and video inline.

"This is an EFL terminal emulator with some extra bells and whistles such as the ability to display in-line images, video and even play music files, background images, videos, Z-Modem like sending (e.g. SSH into a server and use tysend to send a file back to the local terminal), GPU Accelerated rendering (optional - just set the EFL Elementary toolkit engine to use OpenGL) and much more."

https://github.com/borisfaure/terminology

I use wezterm which supports sixel, so I can do exactly what you show here. I use lsix and img2sixel in the terminal. Another fun thing you can try: curl v3.wttr.in/Texas.sxl
On macOS, iTerm implements this, and they even provide a command called imgcat that works like you describe: https://iterm2.com/documentation-images.html

Kitty provides a similar but incompatible protocol: https://sw.kovidgoyal.net/kitty/graphics-protocol/

Many terminals can do this, see a list based on SIXEL support: https://github.com/saitoha/libsixel#terminal-requirements

This list is not complete, KDE konsole supports this too (and other formats) for example.