gomuks icon indicating copy to clipboard operation
gomuks copied to clipboard

Render images on supported terminals.

Open ghost opened this issue 4 years ago • 15 comments

Certain terminals, such as Kitty, support rendering images inside the terminal. In these conditions I think the image should be rendered.

ghost avatar Jul 30 '19 14:07 ghost

+1

r3k2 avatar Jul 30 '19 14:07 r3k2

Ranger supports this by making w3m do all the work with w3mmingdisplay. If gomuks follows a similiar idea, it might not be too hard to implement.

abrahimladha avatar Sep 30 '19 03:09 abrahimladha

Related: The vte library recently added sixel graphics support, so terminal programs built with that library will probably have it before long. This includes gnome-terminal, xfce4-terminal, and others.

foresto avatar Mar 31 '21 23:03 foresto

Sorry for opening a duplicate earlier, I closed it already.

I found another library in go that can do this (unlike vte that's in C++) https://github.com/BourgeoisBear/rasterm

Additionally to sixel it can also use the kitty protocol. One thing it doesn't do is block rendering like the current library though, sadly. So both would have to be used for fallback.

Tycho-S avatar Nov 15 '21 23:11 Tycho-S

i second this, urxvt works perfect with w3m-img

autoteelar avatar Nov 18 '22 14:11 autoteelar

https://github.com/mattn/go-sixel That's a go module

Aleksanaa avatar Dec 23 '22 15:12 Aleksanaa

As far as I understand, before any high resolution image format can be included in-band in gomuks it will need to be implemented in the tcell TUI library that gomuks uses. There is an open PR https://github.com/gdamore/tcell/pull/436 that exposes interfaces in tcell to implement arbitrary graphics protocols as plugins and the PR author has a really cool demo showing a tcell sixel implementation. https://github.com/diamondburned/tcell-sixel Unfortunately, there doesn't seem to have been any activity on the PR recently.

I say "in-band" meaning, the images are sent by the application and displayed directly by the terminal emulator, because there is an alternative "out-of-band" approach, but it has downsides.

w3m-img https://packages.debian.org/sid/w3m-img and ueberzugi (now unmaintained) https://github.com/seebye/ provide raster images support by drawing over a terminal window via an external process. This bypasses the need for the terminal and and TUI library to directly support an image protocol, but doesn't work by default over SSH, and requires that the image drawing implementation support specific OSs and display managers.

https://github.com/mattn/go-sixel appears to work great for encoding sixel images, but at the moment there doesn't seem to be a good way to output those images in the gomuks UI.

reynoldsme avatar Dec 23 '22 20:12 reynoldsme

There's also another approach to adding sixels to tcell since 436: https://github.com/gdamore/tcell/pull/602. Fingers crossed for some implementation to happen :)

ferdinandyb avatar Jul 14 '23 20:07 ferdinandyb

I see gdamore/tcell#602 has now been merged. Could someone please point me in the right direction with regards to gomuks, which source file currently handles the displaying of the ansi image. I would like to see if I get sixel to work in gomuks.

deonspengler avatar Sep 09 '23 12:09 deonspengler

I see gdamore/tcell#602 has now been merged. Could someone please point me in the right direction with regards to gomuks, which source file currently handles the displaying of the ansi image. I would like to see if I get sixel to work in gomuks.

https://github.com/tulir/gomuks/blob/master/ui/messages/filemessage.go#L179

reynoldsme avatar Sep 09 '23 13:09 reynoldsme

I see gdamore/tcell#602 has now been merged. Could someone please point me in the right direction with regards to gomuks, which source file currently handles the displaying of the ansi image. I would like to see if I get sixel to work in gomuks.

https://github.com/tulir/gomuks/blob/master/ui/messages/filemessage.go#L179

Thanks, I will give this try. First time working with go, I normally code in python.

deonspengler avatar Sep 09 '23 13:09 deonspengler

any news on this? :)

r3k2 avatar Sep 21 '23 13:09 r3k2

I have not made any progress, still getting the hang of the go langue.

deonspengler avatar Sep 21 '23 15:09 deonspengler

Another option may be to use ueberzugpp the way that ytfzf does for thumbnails

benmordecai avatar Oct 30 '23 18:10 benmordecai

The problem I have is that the mauview library does not support this. The currently implementation is based on chars via the SetContent() function but for Sixel we would need a separate method that uses something the following code (from the Sixel demo):

 // Move the cursor to our draw position
ti.TPuts(tty, ti.TGoto(sixelX, sixelY))
// Draw the sixel data
ti.TPuts(tty, img.data.String())

coderkun avatar Apr 21 '24 14:04 coderkun