4

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

Update:

Tested on gnome-terminal on Lubuntu 16.04.

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

nightcod3r
  • 952
  • 2
  • 16
  • 32
  • Not sure if this works outside of OSX, but have you looked into `imgcat`? https://github.com/eddieantonio/imgcat – DopeGhoti Jun 02 '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 02 '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 02 '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 02 '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 02 '17 at 20:15
  • @DopeGhoti You mean that your images do NOT dissapear? Having the prompt is at the very end of the window, you execute the command, the image shows and stays? In my case, with gnome-terminal on Lubuntu 16.04, the images shows and vanishes immediately after the scroll that the prompt forces. – nightcod3r Jun 02 '17 at 20:19
  • Confirmed. if I `imgcat /path/to/swanky.png; ls -1 /`, I can scroll back to and fro over the image with impunity. The only machine I can test on right now is iTerm2 on a Mac, though. – DopeGhoti Jun 02 '17 at 20:44
  • @DopeGhoti Agreed. `Terminology` is an emulator that also deals with scrolling, actually w3m implements persistence and wonderfully allows scrolling. The problem here is how to use `w3mimgdisplay` in that way, cause it's supposed to work in non-Mac platforms and with official software only (`Enlightenment`, which includes `Terminology`, is third-party). I've updated the title accordingly. – nightcod3r Jun 02 '17 at 20:49

0 Answers0