Terminal: Display graphical images in terminal

Created on 5 May 2020  ·  13Comments  ·  Source: microsoft/terminal

Description of the new feature/enhancement

It would be nice to have the ability to display graphical images in the terminal by using the API provided by the Windows Terminal. Maybe something similar to https://sw.kovidgoyal.net/kitty/kittens/icat.html or https://www.iterm2.com/documentation-images.html

Area-TerminalControl Issue-Feature Product-Terminal

All 13 comments

So we've already got #448 for display images with sixel graphics, though maybe this issue would make sense to leave open for supporting other binary image formats in the Terminal. Especially for something like gifs, which I don't think sixel is necessarily well suited for.

I'm taking triage off this. It needs a spec, and we need to make sure that we follow the prevailing standards if we're ever going to do this.

Comments from #4544.

from @zyy1998

Display images in terminal

I'm trying to use _WSL_ to substitute some functions on windows, it performed well in some text-only functions. But I'm also want to use _ranger_ ( a linux terminal file explorer ) to replace _totalcommander_ which I often used or even _windows file explorer_, _ranger_ satisfies my content in many occasions but for image preview.

_w3m_ is a terminal web browser that could be used to display images in terminal, and it can also be used by _ranger_. However, _w3m_ didn't work on this terminal.

There are many other terminals like _iTerm2__urxvt_ and _alacritty_ could display images. As a terminal under windows, I think it's more necessary to support this feature.

Proposed technical implementation details

I don't know how does w3m works, but I have noticed that the terminal could be changed the background pictures, so if you want to render some images, you can just change the specific area of the background of the terminal. Actually it's how _urxvt_ handled it.

Of course, you don't have to support w3m, just do something that could display images correctly and the method could be called by other apps like _ranger_, that's all what I need.

Thanks! ( And pardon for my poor English😁 )

You can find more information here: https://github.com/ranger/ranger/wiki/Image-Previews

from @akho

w3m and überzug both rely on x11 to draw an image in a subwindow. It is highly unlikely that either of the two can be made to work in Terminal without also modifying the tools themselves.

Having some way to draw images in terminal would be very nice though. Kitty, for example, implements its own thing (icat), and integrates well with ranger. Would be lovely to have that in Terminal.

Sixel or whatever iTerm2 does are also nice, I think Sixel support is in the pipeline? Not supported by ranger yet, though.

This discussion between the authors of various terminal emulators may be relevant: https://gitlab.freedesktop.org/terminal-wg/specifications/issues/12

It looks like MinTTY went ahead and implemented iTerm2 escape sequences so perhaps this is worth considering as a de facto standard.

I tried to use feh in terminal but I needed X11 running. So I tried both VcXsrv Windows X Server and MobaXterm Home Edition. In both cases, I need to forward to X11 and open Windows firewall TCP port 6000 as described on StackOverflow.

But both also had a lot more than I need or want. And both will only display images in their own terminal. I want to use Microsoft terminal and I want images to look like the mockup at wslutiliti.es (using feh).

I googled how to run X11 server in MS terminal and found this issue... I hope it's feasible. 🤷

It would be fantastic if I could just pipe out HTML5 from my console app and have it display on the terminal.

How about that?

@metawrap-dev How would you propose that would actually work? How would you specify a size for the HTML content to take up within the terminal buffer? How would you deal with scenarios like ssh, where the end terminal might be on another machine entirely, or something like tmux where the end terminal isn't actually a terminal with a physical size in pixels, only in characters?

How would you suppose the terminal actually parse and render the HTML content? A WebView? Embed en entire electron instance? Is JS supported as well, or just HTML?

There's a _lot_ more questions in that suggestion than there are for just "display images", so maybe that discussion warrants its own thread.

has there been any progress on displaying images in WSL2's terminal ?

no. If you'd like updates, click on the subscribe button to the right.
As long as this issue is open and there have been no comments indicating progress, you can reasonably expect that there hasn't been any progress.

Here is an interesting project about rendering videos in a terminal https://github.com/ghaiklor/terminal-canvas

Here is the closest thing I found https://github.com/nabijaczleweli/termimage

Was this page helpful?
0 / 5 - 0 ratings

Related issues

carlos-zamora picture carlos-zamora  ·  3Comments

alabuzhev picture alabuzhev  ·  3Comments

warpdesign picture warpdesign  ·  3Comments

mrmlnc picture mrmlnc  ·  3Comments

dev-logan picture dev-logan  ·  3Comments