The w3mimgdisplay program displays images in buffered terminal emulators. This is how: http://blog.z3bra.org/2014/01/images-in-terminal.html . But it is not very well documented. As pointed out in the post, this thread is probably the best you can get.

Now, the problem is that the image does not stays when the terminal scrolls up. This post argues that "w3m uses it as a persistent process to handle scrolling", but prefixing the command in line 7 with nohup or subfixing with & does not make any change. (And it's hard for me to trace back the use of w3mimgdisplay in w3m.)

So the question resumes as how to execute this command line as a persistent process:

echo -e "2;3;\n0;1;0;100;0;0;0;0;0;0;./image.png\n4;\n3;" | /usr/lib/w3m/w3mimgdisplay


Tested on gnome-terminal on Lubuntu 16.04.

This is the X-face patch by Tamo referred in the post above.

  • Not sure if this works outside of OSX, but have you looked into imgcat? github.com/eddieantonio/imgcat – DopeGhoti Jun 2 '17 at 18:16
  • @DopeGhoti The resolution it provides is quite low, w3mimgdisplay does a much nicer work. Actually, on OSX you have other solutions that do the job, but won't work for Linux. – nightcod3r Jun 2 '17 at 18:20
  • The resolution by default is scaled to fit your terminal to avoid horizontal scrolling. There are options to override this. – DopeGhoti Jun 2 '17 at 18:43
  • @DopeGhoti Right. Problem is that if I just keep pressing the intro key, when it is supposed to scroll up (or after changing workspaces), it simply dissapears, the program is not persistent. – nightcod3r Jun 2 '17 at 19:01
  • I suppose that unreliable persistence (I cannot replicate the disappearing images you suggest) may be something that one has to endure as a price for hacking image support into a terminal emulator. – DopeGhoti Jun 2 '17 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.