What approach can be used to display an image in a console (no X windows)?

For example, I can use curses/ncurses to divide a console into different panes, but in some situations I would like to display an image in one of the panes. Having to switch to X, and assume all that baggage and overhead just to display one image seems like complete overkill. I DO NOT need a windowing system or mouse handling. I just need to put an image on screen.

The problem I have with X Windows is that it is a "windowing" system, whereas I prefer a frame-based approach (no overlaps) like curses. (I think the whole "window" paradigm invented by Xerox Parc which conceives of "windows" as an analog of pieces of paper on a desk that lay on top of each other is idiotic.)

In theory this should be possible, because, as I understand it, consoles are not actually really consoles anymore. They are emulated consoles and they actually are implemented with a full screen resolution which has a pixel-by-pixel control. The question is just how can this emulator be extended to support limited display of raster images on the console?

One possible solution, albeit Linux specific, is the Linux Framebuffer functionality (fbdev). Is it possible to get this to play nice with ncurses?


4 Answers 4


The "emulated consoles" are system-specific, as you understand with your reference to fbdev. Furthermore, they are generally integrated into the kernel, so trying to modify them directly would require modifying the kernel, which is certainly more 'overkill' than putting up with X.

You could use fbdev directly, or write something based on SDL like Thomas Dickey suggests, but as he said, none of the necessary work has been done, and the amount of work that represents should not be underestimated.

But while most of the common desktop environments are fairly heavy-weight, X itself is not (by any remotely modern standards). If you have an app that is primarily text-based, but you need to put up an image every now and then, consider using X without a desktop environment. How? Use startx or a custom script to start the X server and an xterm (or your terminal emulator of choice), full-screen, with no window manager (or find one of the alternative ultra-lightweight WMs). Hide the mouse cursor if you want. Then, from within your text-mode program, you can start and stop lightweight image-displaying X clients at specified locations on the screen, and remove them under program control. You can resize the xterm or just accommodate the fact that part of your text screen will be obscured. Of course, there are an unlimited number of variations on this theme, but you get the idea.

I used to use X on Unix machines with under 4Mb of RAM (not Gb), so it's not necessary for X to be bloated. As a beneficial side-effect, you gain platform portability (you can potentially target anything with an X server) and the ability to run remotely.


In principle, perhaps. But none of the necessary work has been done. ncurses is based on POSIX termios, and framebuffers have little to do with that.

PDCurses was ported to use SDL (Simple Direct Media), so it's "doable".

  • I was just about to mail you to ask, but you beat me to it. Yes, I guess the remote aspect of ncurses precludes using the buffer; it would have to be some kind of purely local console windowing system, I guess. Jan 22, 2016 at 18:48

Not strictly ncurses, but terminology is a terminal emulator with image support built in. If you build EFL with the fbdev backend, it will run without X. Do note that fbdev is considered deprecated in the linux kernel, so no new drivers are being produced for it. To run terminology with the fbdev backend:

ELM_ENGINE=fb terminology

Depending on your distro, EFL may or may not be built with fbdev support. Check that ./configure was run with --enable-fb


You could try libaa. The ASCII Art is pretty good, though even a large screen may require zooming to see any detail. The display app is called aview, but only reads p?m family format, e.g. .pnm. A quick run through Imagemagick's convert utility can take care of that. See the following for details, some distro's carry libaa and the utilities. There is a gallery to demo the capabilities of libaa.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .