I've created a minimal Linux system which boots to the console and does not contain any kind of graphical environment.
I now want to display an image file from my C program or a bash script on the screen.
How can I do this?
The simplest way to view text files in Linux is the cat command. It displays the complete contents in the command line without using inputs to scroll through it. Here is an example of using the cat command to view the Linux version by displaying the contents of the /proc/version file.
For terminal users, feh is a great tool to view PNG files. It is a lightweight and straightforward tool that uses command-line arguments. Feh will launch the image and window size respective to the image size. To control image display and how the tool works, consider the feh manual pages.
If your system has a framebuffer device, i.e. /dev/fb0, then there's the fbv framebuffer viewer utility for JPEG, GIF, PNG, and BMP images. (It's available as a target package in Buildroot.)
And if you have a suitable raw image (e.g. a framebuffer capture), then that file can be written directly to the framebuffer device.
See Super fast Linux splashscreen for more details.
There are a few options.
libaa
or libcaca
to convert an image into “ASCII ART.”svgalib
to write to the hardware, eg, using zgv
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With