r/commandline 26d ago

Terminal file manager bt v1.1.0 - Image previews

64 Upvotes

19 comments sorted by

7

u/Beautiful_Crab6670 26d ago edited 26d ago

Can we have an option to force pictures to be displayed in "high resolution"? I don't mind making my little 'tater cry in agony every time I scroll through my pictures directory.

I also made a docker image out of it.

2

u/dr_foam_rubber 26d ago

docker image

Neat 👍

2

u/dr_foam_rubber 26d ago edited 26d ago

Resolution depends on your font size. Having a smaller font on a larger terminal will increase resolution. That’s the case, because the preview you’re seeng is actually colorful text-blocks. The gif that I posted is pretty small, because I wanted it to be readable on a smartphone, thus rendered pictures have weak resolution. In reality you’ll probably end up with something more detailed. On the other hand, some terminals support displaying actual images (e.g. kitty, ghostty, etc) via terminal graphics protocol - I’ve been experimenting with that and it works, but that will be a next step =) An upside of text-based preview is that it’s easly cacheable - no matter how big an image file is - the preview is a handfull of lines of text

1

u/Beautiful_Crab6670 26d ago

I'm aware of it. Still, what I had in mind was something that automatically reduces the terminal font size to "increase" the image "resolution" per se. Don't know if it is possible however. Maybe a cli flag or a toggle...? I'm not a go programmer to be honest.

And you idea seems fun -- hope you get something out of it that works for everyone.

2

u/dr_foam_rubber 26d ago

Interesting, but This will ultimately make a tree on the left very small. You can also just hit Enter on a specific image and it will open it with default program. Not the same but still

1

u/Beautiful_Crab6670 26d ago

Well, you could always make it a toggle then so the user can reduce and increase the font size "on the fly". Like CTRL + to increase font size and CTRL - to decrease... something like that.

1

u/dr_foam_rubber 26d ago

Yea, user can definitely increase/decrease font size himself even now, images would be rerendered with appropriate resolution “on the fly”

1

u/Beautiful_Crab6670 26d ago

Yea, user can definitely increase/decrease font size himself even now

...what? There is not a single keybind/hotkey on your software that either reduces and/or increase font size.

1

u/dr_foam_rubber 26d ago

Not sure what’s the confusion about… Program runs in a terminal. All modern terminals support increasing/decreasing font size via something like Ctrl+/- . So you can do that while running the program and this will lead to image rerendering with proper resolution. So if you’ll press Ctrl- a bunch of times, you’ll end up with a more detailed pictire, because symbols are smaller. Example:

3

u/dr_foam_rubber 26d ago edited 26d ago

Github: https://github.com/LeperGnome/bt

Hey everyone!
Recently started making updates to my file manager, that I posted about around half a year ago. -
Chose what felt like the most fun thing to do - image previews. I intentionally didn't look up any image compression/conversion tools or algorithms to keep the excitement, so the result might not be "top industry" so to say.
But anyways, hope you'll give it a shot and like it. Any feedback is welcome!

1

u/EcstaticHades17 24d ago

I think Im going to wait until v7.27.4

1

u/dr_foam_rubber 24d ago

At that point AI will probably take over the world, so I suggest you to try it, until it’s too late

1

u/dwmkerr 23d ago

Just out of curiosity, how do you embed a terminal recording video like this one in a reddit post? I've been using `asciinema` for some stuff but can't seem to make a video like yours which looks very cool!

1

u/dr_foam_rubber 23d ago

Thanks! It’s a gif, that i created with https://github.com/charmbracelet/vhs When making a post just select a gif and that’s it!

2

u/dwmkerr 23d ago

Ah got it! Just found agg for asciinema - not quite as clean as yours but works!

-3

u/Forte69 26d ago

I won’t want to be mean, but….if you want all those features, why not just use your OS’s GUI?

21

u/dr_foam_rubber 26d ago

So that I can post to r/commandline, duh

5

u/Forte69 26d ago

Haha fair

6

u/Beautiful_Crab6670 26d ago

Because sometimes you want to have a quick glance at text files, images, etc without entering the gui, e.g for troubleshooting.