Display image over SSH, no X

10

4

Is there any way to display an image over SSH? There is not need for good quality, I just need an idea of what is in the images. Mostly these are icon files for websites and such. Sometimes I can just forward X over SSH and use display but sometimes I can't. I don't mind working in a non-X tty for applications such as fbi.

I have tried jp2a but most of the images are in .png format and it is cumbersome to convert each one to check what is in them. Also, by using only the ASCII characters the display is very very limited. Perhaps if it could use arbitrary UTF-8 characters this could be better.

I have tried fbi but it complains ioctl VT_GETSTATE: Invalid argument (not a linux console?) even when I'm SSHing in through a non-graphical tty. I did try the -T 2 option which doesn't throw any errors but I don't see the image. I suspect that the image is being 'displayed' on tty2 of the server, which I have no way to see (I could not get to it with chvt 2 even though I have root access).

I have tried links, w3c, and other console browsers but the best that I've gotten out of them is to see the image file displayed as if it were run through cat.

I have tried mplayer's console output options but those only support video, as they are in fact video codecs.

I have tried zgv however as a normal user it complains you must be the owner of the current console to run zgv and as root it just hangs, no output.

dotancohen

Posted 2013-01-25T11:49:16.630

Reputation: 9 798

Answers

9

Try 'img2txt'. For Ubuntu it can be found in 'caca-utils' packet.

'caca-utils' seems to be also available as rpm.

Kride

Posted 2013-01-25T11:49:16.630

Reputation: 1 079

It works fantastically well. But I still can't make sense of the images, lol. – Camilo Martin – 2014-07-11T03:02:16.293

In your terminal program, lower the font size to something like 1x1 before viewing the image, then resize the terminal program to max size. – LawrenceC – 2015-07-04T23:01:03.087

This is better than pretty much all the solutions I've read considering it's easy to install and works over ssh. – Sridhar Sarnobat – 2019-09-03T20:46:42.313

I never heard of it before, but it seems perfect. +1 – Hennes – 2013-01-25T12:22:47.207

2

Oneway to display an 'image' with a text screen is via aalib.

That will use ASCII chars to render an image, and if you have a large enough text area (sort of resolution) then you can recognise what is being shown.

You would run the conversion to ASCII-art/movies on the remote side of the SSH link.

Link: aalib demo on youtube.

Also, by using only the ASCII characters the display is very very limited.

Aye. Which means that unless you have a large terminal to play with you will barely recognisabnle images. If you can use a large terminal on a high density display (with sharp letters even when you use a tiny font) then it is useable.

Hennes

Posted 2013-01-25T11:49:16.630

Reputation: 60 739

Thanks. To use aalib, one must install (in Ubuntu) aalib1 and run it with asciiview file.jpg. That last command took me a while to figure out. – dotancohen – 2013-01-25T13:25:05.070

3Revisiting this one year later, now to use asciiview one must install the aview package. – dotancohen – 2014-01-16T07:50:50.947

1

not as fast as ascii (but full quality) view concept:

 localComp$ ssh remoteCompIp 'cat image.jpg | ssh localCompIp fim -i' 

fim works for pdf files too, and for wav/mp3/mp4 files fim -i can be replaced with

mplayer -vo fbdev2 -cache 16384 -.

MetNP

Posted 2013-01-25T11:49:16.630

Reputation: 111

2What is fim and is there a link for fim? Please expand. – suspectus – 2015-07-04T08:12:28.023

1@suspectus, actually it would be better if fbi can do this, because it seems simplier and faster tool... but i was looking for framebuffer image viewer that can display image from pipe (stdin) and fim comes up on [http://manpages.ubuntu.com/manpages/quantal/man1/fim.1.html] ubuntu manpages, there is also [https://aur.archlinux.org/packages/fim] (aur) for archlinux. but there is maybe somewhere better tool for this purpose – MetNP – 2015-07-04T22:01:45.727