-
Notifications
You must be signed in to change notification settings - Fork 786
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
sixel support for images with pixel resolution #233
base: master
Are you sure you want to change the base?
Conversation
Mintty panic (go-tty #20) problem is somewhere in queryTerm() or tty_windows.go (go-tty) I think that handling events both with termbox and go-tty is bad but I couldn't make it work in a different way. Probably someone with more Go +/ signals experience finds the answer. |
the important ANSI escape strings here are:"\033[0c" for querying the terminal capabilities - we need a 4 for sixel. We also need to know what the size of a character box is in pixels this differs from terminal to terminal: "\033[14t" gives us the terminal size in pixels "\033[18t" gives us the terminal size in cells from that we can calculate the cell size in pixels. We set the position with "\033[%d;%dH" before printing the sixel string. the position string is simply prepended. The first %d is the Y position (in cells) and the second the X position. |
xterm works now. The dimensions are now first queried via TIOCGWINSZ (unix only) and then with \033[14t and \033[18t. current state: the rendering with images is slower and seems to "stack up"(?) - we should somehow cancel rendering (only from resize or general?) when there is already a newer event. |
opened "screen" pass through issue #56063==> ocs52.sh
==> todo: make screen sixel size dependent on screen version |
initial tmux support - still buggy: pass through of escape codes through tmux to the terminal works but I assume that the terminal response doesn't get back through tmux (?) pass through works by wrapping: changed draw order: ASCII art first in case sixel fails |
conhost issue: microsoft/terminal#120 |
iTerm2 sixel support: gnachman/iTerm2@0d0003d |
screen can already pass escape sequences <= ~770 bytes through to the terminal. the string has to be prepended by '\033P' and appended by '\033\'. |
urxvt with sixel patch or from the fork (older) How to build:
|
ranger img_display.py Wiki Image Previews man 7 urxvt for escape sequences |
added support for urxvt (pixbuf backgrounds), kitty (remote transmission) and MacTerm |
notes for xterm sixel implementation:
==> TODO: |
images in conhost: idea from http://www.cplusplus.com/forum/beginner/223667/#msg1024626 (by JLBorges)
Go library: |
I'm working on a go-w3m library here: https://gitlab.com/diamondburned/go-w3m/ |
Both are interesting libraries, thanks for creating them. I already planned implementing a drawer with xgb myself (was too much effort for me atm though learning X11...). |
Latest commit changed go-w3m's LICENSE to MIT. I'm still working on |
@diamondburned I have a few problems with ueberzug-go.
|
Already stated that |
(1) Well, that didn't sound like that.
(2) Depends on how similar you want to do that:
I know. That's why I mentioned (1) and (2).
Edit:
...
No, you clearly aren't pretending it.. |
I'm not pretending to be a port. I'll keep this as it is. |
Is sixel support now working with termui? If so, would be the only system I know besides Jexer to properly mix text and graphics. It would be great to have more toolkits doing this. I have found several more terminals with sixel support: https://gitlab.com/klamonte/jexer/wikis/terminals Also, vte and xterm.js are testing sixel support now, and alacritty is implementing. It is likely in the 3-12 month time frame that vastly more terminals will be out there that support sixel. |
Just confirmed this works on foot. |
Couple FYIs:
|
I'm currently working on a tcell pull request and a SIXEL library for it: https://github.com/diamondburned/tcell-sixel |
Any news about it? |
This looks fantastic, awesome job! :-) I wanted to pass on some things I've picked up recently, on the odd chance it could help. (Even if just by way of "go check out notcurses, it's really cool." ;) ) I added translucent windows with images under/over, thanks in large part to some clues from notcurses. Some notes of that work are here: https://gitlab.com/klamonte/jexer/-/issues/88 . I also wrote down more details on my particular mixed image-and-text cell model here , with some narrative (and again the notcurses shoutouts) here. For encoding to sixel, check out notcurses' new octree implementation sometime. It's very likely the fastest and highest-quality anywhere right now, at least for xterm-type terminals. (libsixel was tested on real hardware, so that might give it an edge still in terms of compatibility.) Depending on how you choose to render, you may find that 256-bit colors per sixel could still result in close to 16-bit apparent visual bit depth on the actual screen, making the drive for non-sixel support a bit less crucial. (Note that the best bit depth for sixel is 19.97 bits: 101^3.) The screenshot link is my very naive median-cut encoder, which is much worse than notcurses' octree encoder -- but that's still good enough that you might not be able to tell when I'm using iTerm2+PNG vs sixel. Finally, and to my utter surprise, I may have encountered an actual xterm bug: https://gitlab.com/klamonte/jexer/-/issues/89 . Both foot and wezterm are doing quite well on sixel, and very nice options to have for testing. |
This PR transformed into this library: https://github.com/srlehn/termimg A widget for termui can be found in the tui/termuiimg subfolder. |
addresses #213
#15,#16,#21; open, no fix yet: #20abduco& dvtm, mtm, neercs, twinmlterm,xterm, tmux, screen, mintty, conhost, yaft, iTerm2, mactermadditional drawers:
This needs the current https://github.com/mattn/go-tty!
Terminals with sixel support
mlterm, mintty (cygwin terminal), xterm with configuration, yaft
https://github.com/saitoha/libsixel/#terminal-requirements