Any ideas how to render images in console?
Im writing cli application and was kinda inspired of super file
It can preview images in fs (example is bellow)
So, i decided to implement smth similar
Any libs for that?
12 Replies
⌛
This post has been reserved for your question.
Hey @Tusya <3! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
assuming you will want to use ascii character you could:
- load the image into BufferedImage
- read all pixels of the raster
- display them into console according to their xy coordinates
- for changing colors you could use ascii codes
obviously you are gonna want to loop through all the pixels
getWidth, getHeight for that
it will render image as it is, when pixel == char in terminal, so most of the time it wont fit in terminal
there should be some resizer or smth
there are ways to get the size of the terminal
at least on Linux
but doing something like this won't work on any system
k, with power of chat gpt i made it work!
u mean getting term size?
yes, width and height of the terminal
At least on Linux, there are commands for that
afak there r platform specific stuff for that
yes, exactly
but that means even if it works on one device, it may not work on another
default w and h on fallback 🙂
and then you have the issue of terminals (especially on Windows) not supporting ANSI
those gonna be unsupporter by app at the first place i guess...
Post Closed
This post has been closed by <@997160896457625610>.