15

When I am on the console (the tty, the virtual terminal, which you reach with Ctrl+Alt+F1-6, not a terminal emulator), what options do I have to view images, tiff, whatever that's not text?

3

9 Answers 9

11

You can use the library from AA-Project

enter image description here

Applications:

  • xine-console [video]
  • xaos [fractals/mandelbrod]
  • vlc [video]
  • aview [photos]
  • ... a.m.o
9

First off you must make sure the framebuffer is enabled, there is absolutely no way to view images in text mode. Once you have the framebuffer enabled, you can use the program fbi to view images.

Package: fbi

Linux frame buffer image viewer

This is an image viewer for Linux frame buffer devices. It has built-in support for a number of common image file formats. For unknown files, it tries to use convert from the ImageMagick package as an external converter. It also includes fbgs, a Postscript and PDF viewer.

9

Updated answer

Install ranger, a filemanager for the console. It shows colored images if the requiered programs are installed. Look into their rc.conf and search for preview.*image to learn how they do it and which programs they use and what requirements they have. Here is a list of programs they try to use (but better look into the rc.conf file:

  • w3m
  • iterm2
  • terminology
  • urxvt
  • urxvt-full
  • kitty
  • ueberzug

Old answer

Many images are coloured, hence you may use libcaca’s ASCII image viewer (cacaview) and image to text converter (img2iso).

  • To browse images, use the ASCII image browser:

      cacaview /usr/share/pixmaps/*.*
    
  • Convert images to text-based coloured files:

      img2txt -W 150 penguins_mating.png > penguins_mating.txt
    
  • View movies and videos in text console:

      mplayer -vo caca https://upload.wikimedia.org/wikipedia/commons/4/41/Big_Buck_Bunny_medium.ogv
    

    Mostly you don’t need the option -vo caca if you view your video in a text-only environment (terminal with ssh-connection, virtual terminal etc.). By default you’ll get the noncolored text-output (i.e. -vo aa), but color may be better.

For Fedora and Ubuntu the package caca-utils has to be installed.

Read here for more information.

enter image description here

2
  • cacaview in Ubuntu 21.10 opens a new window, it does not print the image out (in ASCII with colours) in the terminal.
    – Flimm
    Commented Nov 20, 2021 at 18:54
  • @Flimm Use ranger as described above. See my updated answer.
    – erik
    Commented Nov 21, 2021 at 20:43
2

You can use a framebuffer device. The framebuffer mechanism is the one used to display Tux when you boot.

There is also the libcaca used to display ASCII-art images.

4
  • Could you add some more detail? How would one go about using these tools?
    – terdon
    Commented Mar 3, 2014 at 15:31
  • It depends very much on your hardware and your needs. You should provide more details in your question and give context.
    – lgeorget
    Commented Mar 3, 2014 at 15:53
  • Not my question. I am pointing out that when answering a question, you should include the details on how to do it. You are just giving two links to external sources, something we try to avoid. The idea is that answers on the SE sites are self-contained.
    – terdon
    Commented Mar 3, 2014 at 16:02
  • Of course, but there is not just one way to use these tools. And there is not much context in the question so...
    – lgeorget
    Commented Mar 3, 2014 at 16:16
2

mplayer has a framebuffer driver (2 versions, in case one doesn't work). Use

mplayer -vo fbdev [or fbdev2] <filename>

For images, fbi and fim work. Whatever else these two can't handle, you can probably convert to images on the fly ( imagemagick works like magic), so you have everything covered.

2

This answer is limited to native linux consoles that are frame-buffer enabled. This option will give you full resolution real images and real video (not ascii-art) without X11 or wayland or mir.

As of 2018, debian offers a package fim which includes an image viewer fim and a document viewer fimgs. For fimgs, the default resolution is 96x96, which you'll probably find inadequate. I find that calling it with option -r 256x256 is sufficient. These two programs are meant to be 'modernized' versions of other programs also available in debian, fbi and fbgs. A particular disappointment with the older program fbgs is that it renders slowly and will render an entire pdf file before displaying even a single page, so if you have a many-paged document, you'll be waiting a long long time.

There are several programs not specific to framebuffer operation that have fine framebuffer support. The w3m web browser will display images when support package w3m-img is installed. The feh image viewer works in a frame buffer console, as does vlc for video.

All this is all very well and good, but in order to use any of these options you will first need to set things up.

The good news is that pretty much all modern linux distributions ship kernels with the framebuffer available. What isn't commonly done is configuring that frame buffer to be actually used. For that, if you are using the grub bootloader, you will need to make sure the following exists in your file /etc/default/grub (your specific resolution number may be different):

  GRUB_GFXMODE=1024x768
  GRUB_GFXPAYLOAD_LINUX=1024x768

And you will need to make sure the following line is commented out:

  #GRUB_TERMINAL=console

After that, you will need to update grub by running update-grub and will need to reboot for the changes to take effect.

You also may need to add your user to the video permissions group:

  usermod -a -G video <user_name>

Some programs may require special capability access. According to my notes, that is the case with fbi, but I see on my system it is not the case for fim. Go figure. In any event the command for that is:

  setcap 'cap_sys_tty_config+ep' /usr/bin/fbi

A program that I can not recommend, and have only had trouble with, is fbterm. It kept messing with my color schemes for emacs, mc, less and other programs, and I recall that it wouldn't play nicely will tmux.

An important note about using vlc in a framebuffer console: I found that sometimes, in a way I wasn't able to reliably reproduce, vlc would freeze and not release the framebuffer, short of "alt-sysrq"-ing the machine to reboot. Sometimes, this happened when attempting to switch to another virtual consoles; sometimes when experimenting with what vlc keystroke commands would work. You have been warned.

3
  • there's also the term emulator terminology that can be run on a framebuffer console (terminology --nowm). the included utility tycat can embed images.
    – quixotic
    Commented Jan 31, 2018 at 0:39
  • Is that the one from the people of the 'enlightenment' desktop? I evaluated it maybe a year ago and it was buggy then, but if you can vouch for it, great! Commented Jan 31, 2018 at 2:51
  • i just started looking at it and can't confirm lack of bugs, sorry. it's working mostly-ok on one system (intel gpu), doesn't work on another (nvidia proprietary driver, untested but likely works under nouveau). set XKB_DEFAULT_{LAYOUT,VARIANT,OPTIONS} env variables for xkb layouts (though AltGr doesn't seem to work right atm).
    – quixotic
    Commented Jan 31, 2018 at 3:15
1

ffmpeg can show any image format fullscreen :

ffmpeg -i image.ext -s $(< /sys/class/graphics/fb0/virtual_size tr , x) \
       -vcodec rawvideo -f image2 -pix_fmt bgra -y /dev/fb0 &>/dev/null && read

1

There is a library today today named SVGAlib. It directly handles the video card, with user-space drivers (imported mainly from X).

It has no drivers to most current video cards, but

  • it has VESA output driver (i.e. essentially it can handle the output with the BIOS drivers)
  • it has fbdev drivers (it handles /dev/fb0 as a video card, thus essentially it uses the kernel drivers).

There are many softwares using SVGALib, for example mplayer (for video output), and answering your question, the xzgv image viewer.

Although you will have to compile them from source, because Linux distribution developers all think since roughly a decade, that X (with continuous nice, never-fulfilled promises like kgi, ggi, and today wayland) are the future.

-7

None. You need some kind of display server to display images. Xserver, mir, wayland or similar provide the interfaces for images. getty is designed to emulate text terminals and doesn't have the ability to display images.

3
  • 2
    I kind of disagree. How would the Tux be displayed at boottime ? commons.wikimedia.org/wiki/File:KNOPPIX_booting.png ;-)
    – lgeorget
    Commented Mar 3, 2014 at 14:58
  • Framebuffer. Without enabling frame-buffering it can't be done, should've mentioned that. But, They also mentioned being on a real terminal. Forgetting that they're not on a real terminal, on a real terminals (vt1000) or similar I'm fairly certain it's not possible. Commented Mar 3, 2014 at 15:06
  • Many real terminals have the ability to draw graphics. Graphics capability was a selling point in the 1980s. And getty isn't emulating anything.
    – JdeBP
    Commented Jan 9, 2015 at 16:41

You must log in to answer this question.

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