darylhjd / mangadesk

Terminal client for MangaDex 📖
MIT License
755 stars 29 forks source link

[Feature] Display images on terminal instead of downloading its #6

Closed khanhtc1202 closed 2 years ago

khanhtc1202 commented 3 years ago

Hi @darylhjd, thanks for your works.

In some cases, instead of persistently stored images locally which could lead to some copyright problems, I guess temporarily store images and let users read directly in their terminal could be a better option.

I think we could use some libraries like pxl or pixterm for image rendering on terminals. The other things left are: to add new showing screens and navigation on that viewing screen. What do you think about it?

darylhjd commented 3 years ago

You are welcome :)

I have those 2 libraries in my sights. Will be experimenting to test out feasibility.

To note is that I don't think a great many people would enjoy reading manga from the terminal, even though it would be cool to implement.

jakeisnt commented 3 years ago

My primary concern here would be that the pixelated images provided by those libraries would introduce some reading difficulty. I think the easiest solution here would be to use another program like w3mimgdisplay that's able to show these images at their native resolution and scale them for the terminal.

This is common practice with terminal file browsers like ranger and lf - here's a demo of ranger showing native resolution image previews.

khanhtc1202 commented 3 years ago

I think the easiest solution here would be to use another program like w3mimgdisplay that's able to show these images at their native resolution and scale them for the terminal.

Sure, that's nice. I use both ranger and lf too, and nothing to complain about w3mimgdisplay features. But does it provide API to interact from go source code or we have to install it as standalone binary first as cli's dependency?

jakeisnt commented 3 years ago

You're right, it would have to be installed as a standalone binary and executed with some shell command interface from Go. That can be handled by a package manager and "hardcoded" into mangadeck, or the user can provide an image preview script like lf or ranger allow for!

runoono commented 3 years ago

does the api let you list pages for a chapter? maybe we could set up a command to load images like TTRV's mailcap system with curl and pipes

darylhjd commented 3 years ago

this is near bordering the scope of my knowledge and ability haha

for the api, what happens is you will need to request for each page's data individually.

runoono commented 3 years ago

can you get a page count? you could make a submenu with sequential page numbers and have users request them one by one.

as for the commands, you could have them be configured within a config file with a place holder for the page urls such as "curl %page" for example, then execute the command with os/exec during runtime

darylhjd commented 3 years ago

there is currently no way to show images with the current UI library (tview) i am using, which is a limitation i am unable to work around.

there are programs out there to show images in the terminal but as far as my knowledge goes i cannot find a way for them to interact with tview, or transfer control back and forth after execution/termination. this includes cross-platform compatibility.

as such i probably will not be pursuing this personally, but i may revisit this in the future.

if anyone can actually accomplish this now, you may create a pull request and we shall have a good discussion :)

Kabouik commented 3 years ago

My primary concern here would be that the pixelated images provided by those libraries would introduce some reading difficulty. I think the easiest solution here would be to use another program like w3mimgdisplay that's able to show these images at their native resolution and scale them for the terminal.

This is common practice with terminal file browsers like ranger and lf - here's a demo of ranger showing native resolution image previews.

In addition to w3mimgdisplay, there are also alternatives like ueberzug, kitty terminal's icat, and probably a couple users. And some other tools to show images in terminals that don't support sixel or don't have their native solution like kitty, such as viu or some other tool whose name I have forgotten, which converts images into ascii (with a surprisingly good result, but probably not enough for reading text).

I might not be a good example of the potential user base of mangadesk since I haven't read mangas in years, but I sure would use it regularly and discover new mangas if I could do everything from the terminal, including viewing images and not having to worry about zooming/scrolling with a mouse or a touch screen.

Very nice project by the way! I came here just to request this feature (as I did on Reddit) and saw this issue already open. :tada: However I see it's probably not going to happen; unfortunately I would have no idea how to make this work either. I will try to view images from nnn instead so that I can stay in the terminal, but unfortunately it won't really handle scrolling/zooming.

darylhjd commented 3 years ago

Thank you!

I understand this is a highly requested feature but I really really don't know how to do it. I'm sorry :"(

I will try my best!

runoono commented 3 years ago

@Kabouik you could try bulk opening it all by running feh *

I'm using this on my fujitsu U810 and i've got a pretty great setup with feh.

Personally I've been trying to get the hang of Go. If I can get the hang of it, I'd love to submit a pr for this

Kabouik commented 3 years ago

No problem, thanks for the amazing work already!

@runoono, Thanks, I'll give it a try. Normally my GUI viewer of choice is viewnior, but I often just use nnn in-terminal image previews (using uerberzug or icat).

darylhjd commented 2 years ago

sorry lads, will be closing this :<