terminal icon indicating copy to clipboard operation
terminal copied to clipboard

w3m images (ranger) display in terminal

Open zyy1998 opened this issue 6 years ago • 5 comments

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

zyy1998 avatar Feb 12 '20 07:02 zyy1998

Have you tried with überzug ? It's the recommended way to get image previews in ranger, w3m is always wonky even when you do get it to work on native Linux.

Also, if you just want something ranger-like on Windows you don't have to use WSL, you can just use lf which runs on Windows (and Linux) natively and is much faster too. But it has no option to do image previews.

EDIT: I couldn't curb my curiosity so tried ueberzug on WSL2 myself and ran into a problem I could not fix: https://github.com/seebye/ueberzug/issues/87 let me know if you can figure it out

jantari avatar Feb 12 '20 17:02 jantari

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.

akho avatar May 09 '20 14:05 akho

FYI, there are separate issues for Sixel (#448), and the other proprietary image formats (#5746).

j4james avatar May 09 '20 23:05 j4james

Thanks for the request here. I'm going to make /dup #5746 the master issue for graphics-in-the-terminal and copy your comments over there.

At the end of the day, if other terminals are doing this in a standards-compliant, secure and portable way... we should consider following suit.

DHowett-MSFT avatar May 11 '20 05:05 DHowett-MSFT

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

ghost avatar May 11 '20 05:05 ghost