Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image preview using terminal graphics #160

Open
maximbaz opened this issue Jan 27, 2022 · 2 comments
Open

Image preview using terminal graphics #160

maximbaz opened this issue Jan 27, 2022 · 2 comments
Labels

Comments

@maximbaz
Copy link
Contributor

It would be interesting to be able to display images directly in the chat, if a terminal supports this.

For example, kitty has developed a graphics protocol, that is supported by several apps and also at the moment of writing one other terminal application:

https://sw.kovidgoyal.net/kitty/graphics-protocol/

What do you think about it?

@exquo
Copy link
Collaborator

exquo commented Jan 27, 2022

Would be neat, but the graphics-in-terminal situation is, in general, more of a hack than a reliable solution. Each of sixel, w3m-img, kitty and iterm methods work on different subsets of the existing terminal emulators and don't always play nice with tmux, compositing window managers, etc.

We could allow the users to specify the command for viewing images that works on their system, like ranger's preview_images_method. But what type of data output / action produced should result from such process call, and how can we use it in scli?

The issue is, these tools draw directly in the terminal framebuffer (except perhaps for the ones that use Unicode half-blocks to produce a "blocky" image). whereas scli gives the control of writing anything on the screen to urwid. There is an urwid.Terminal widget that allows to embed a terminal into an urwid program, but the likelihood of the graphics rendering correctly inside it is even lower than for a regular terminal emulator.

In principle this should be possible - ranger and w3m can do this - although urwid might require a patch first. But TBH, I wouldn't want to be the one going down this rabbit hole :). Of course, any pointers on how this can be accomplished easier are appreciated!

@maximbaz
Copy link
Contributor Author

I see... this is very interesting to know!

@exquo exquo added the distant label Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants