browsh-org / browsh

A fully-modern text-based browser, rendering to TTY and browsers
https://www.brow.sh
GNU Lesser General Public License v2.1
17.09k stars 418 forks source link

Increase the TTY's visual density #137

Open chrisportela opened 6 years ago

chrisportela commented 6 years ago

In browsh the images are pretty hard to distinguish sometimes. I was wondering what you thought of using something like https://github.com/daleroberts/tv as inspiration to design a more powerful image renderer?

In #86 I saw you did not want to move away from text which I believe tv does and helps here since it's goal was viewing 3gb+ images files over a terminal quickly and efficiently. He also created an iTerm specific version called bv which may be relevant to #135

No specific request here since I know you're trying to manage the complexity here, but I just knew he'd suggested his projects in the HN thread and wasn't sure if you'd been made aware of them yet since others are wondering about ways to make the images easier to view.

tombh commented 6 years ago

Thanks for bringing this to my attention. I had actually seen this before. Also my last job was working with huge map tiles, so I very much appreciate the significance of @daleroberts' work. I'd integrate it in a instant if it was written in Go.

His work ekes out a little more visual density than my UTF-8 half block trick by using a greater set of UTF-8 chars, I'd absolutely incorporate that method into Browsh. However, I don't feel it would be as big a return on investment as implementing the magnifying glass feature #33. Browsh's graphics are merely for visual cues, they simply can't be relied upon for anything else. As such any improvements that Browsh makes to its unmagnified graphics, short of implementing true high res pixels, is going to be subjective and largely academic. Whereas the magnifying glass actually has the potential to open up new abilities, like solving captchas.

ArniDagur commented 6 years ago

This feature is definitely near the top of my wishlist for this project, however, I have one concern. The Python implementation of daleroberts/tv is slow; displaying a simple image can take seconds, and although Go is faster than Python, I worry that rendering on the CPU using any language is going to be kind of slow.

Although I'm no expert on this topic, I suspect one could use computing shaders like those offered by Vulkan to render using the GPU, that is, creating an array of characters and colours for each terminal cell based on image data. I have been attempting to reimplement daleroberts/tv in Rust using vulkano-rs/vulkano as a proof of concept, but the learning curve is kind of steep for me.

If any GLSL/GPU computing person could give me their thoughts on the feasibility of this idea and/or implementation advice, it would be very much appreciated by me.

Noskcaj19 commented 5 years ago

I have actually written an image viewer using the same unicode block technique in Rust Noskcaj19/term-image and may be able to help. It isn't GPU accelerated, however parallelism or SIMD may be possible. However the output speed is limited by the terminal emulator speed, not the program itself.

tobimensch commented 5 years ago

@Noskcaj19 I'm looking forward to your pull request. :D Welcome!

niutech commented 4 years ago

Sixel has an implementation in Golang: go-sixel. Is it possible to include an optional Sixel mode, which renders images using it?

tombh commented 4 years ago

I don't want to support sixel. I want to remain true to Browsh's ability to render everything in pure text. Ultimately I want to develop a client in the browser, so you don't even need a terminal to benefit from Browsh.

niutech commented 4 years ago

That's really cool! Will it emulate terminal in a browser, like e.g. Xterm.js? But still the issue is resolution. If you want to see images in details (like a CAPTCHA), would't it be good to temporarily switch to the Sixel mode just to see the images (possibly in the new tab)?

tombh commented 4 years ago

The whole reason I built Browsh was for low bandwidth internet. So I want the browser client to be as absolutely minimal as possible, I think terminal emulation will be too much.

I think #33 with the idea of a magnifying glass is the approach I'll take to solving issues like with CAPTCHA