gui-cs / Terminal.Gui

Cross Platform Terminal UI toolkit for .NET
MIT License
9.55k stars 681 forks source link

Terminal image support (Kitty graphics protocol, Sixel, etc) #3005

Open rsmirnov90 opened 9 months ago

rsmirnov90 commented 9 months ago

Has anyone considered adding support for rendering an image in the text terminal?

I can think of many scenarios where this could come in useful, and would love to work on something like this myself though I likely wouldn't even know where to start.

tznind commented 9 months ago

There has been consideration but never more than that.

See this discussion for example (which contains link to example code): https://github.com/gui-cs/Terminal.Gui/discussions/1265

If you are motivated to give it a go then the best place to start would probably be getting a standalone console app to produce a sixel image. Then we can help integrate it into the driver layer or a View.

Nutzzz commented 1 month ago

FYI, VT support has recently been much improved in Windows Terminal/ConPTY, and Sixel is now working in Windows Terminal (Canary only for now)! See https://github.com/microsoft/terminal/pull/17510 and https://github.com/microsoft/terminal/pull/17581

I grabbed https://github.com/gnachman/libsixel-1/blob/master/images/snake.six and got this:

image

BDisp commented 1 month ago

It's necessary install Sixel?

Nutzzz commented 1 month ago

It's necessary install Sixel?

For the above test, nothing to install was necessary (other than WT Canary). It worked in both PowerShell and cmd.

BDisp commented 1 month ago

My WT doesn't show anything about Canary in the version.

tznind commented 1 month ago

Here is a link to the blog post, which contains a link to GitHub repo including installers

https://devblogs.microsoft.com/commandline/introducing-windows-terminal-canary/

Presume canary is just the 'early adopter' channel. So this feature will come later to Windows Terminal core releases too.

Nutzzz commented 1 month ago

Presume canary is just the 'early adopter' channel. So this feature will come later to Windows Terminal core releases too.

Correct (the canary refers to the "coalmine" adage). You can download the latest Canary installer here: https://aka.ms/terminal-canary-installer or just wait until the end of the month (estimated) to update your WT from the Microsoft Store.