this post was submitted on 28 Dec 2023
247 points (97.3% liked)
Linux
48624 readers
1681 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
For rendering high quality images in the terminal, check out the Kitty graphical protocol. I don't know if they are any python libraries to use, but I think that they are. P.S. This seems to work well https://stackoverflow.com/questions/58138638/how-to-display-graphical-images-in-kitty-terminal-using-python
I went with chafa as it's terminal agnostic and supports various modes.
Then again, I'm not really sure a tui frontend needs high quality image rendering. Earlier I even considered going completely 1bit braille or just ASCII just so that the image doesn't take all of the focus at the expense of the post body.
As mentioned by another commenter, I believe opening the full image in an external viewer is a much better solution, not to mention easier to implement.
You could also look into using sixel. It's kinda like the kitty protocol but older and terminal agnostic.
https://en.m.wikipedia.org/wiki/Sixel
Thanks, I've only heard of sixel, but never really read into it. Sounds promising.
A suggestion is do it like neofetch and let the user choose. Amazing work.
does this protocol work for other terminals? such as alacritty, foot, urxvt, or even st (with appropriate patch ofc)?
A quick research tells me that there aren't patches for other emulators, but the protocol seems well described, so making those patches is possible. I could also take a look at Alacritty source code and deicide if I could make this project work.