<<< Date Index >>>     <<< Thread Index >>>

Re: w3mimgdisplay use?



* Kyle Wheeler [09.Kas.07 15:16 -0600]:
> Does anyone know how to use w3mimgdisplay to display images on the 
> terminal (or if its even possible)? I'm hoping to be able to put it in 
> my mailcap so that when I view an attached image, it'll display it on 
> the terminal.
> 
> I've gotten as far as understanding that it has an input command 
> language, so I can query the size of the image, like so:
> 
>      echo '5;./test.jpg' | w3mimgdisplay

The w3mimg protocol is documented in the source files like this:

  0  1  2 ....
 +--+--+--+--+ ...... +--+--+
 |op|; |args             |\n|
 +--+--+--+--+ .......+--+--+

  args is separeted by ';'
  op   args
   0;  params          draw image
   1;  params          redraw image
   2;  -none-          terminate drawing
   3;  -none-          sync drawing
   4;  -none-          nop, sync communication
                       response '\n'
   5;  path            get size of image,
                       response "<width> <height>\n"
  6;  params(6)       clear image
 
  params
       <n>;<x>;<y>;<w>;<h>;<sx>;<sy>;<sw>;<sh>;<path>
  params(6)
       <x>;<y>;<w>;<h>

> And I *believe* the command to display an image looks something like 
> this:
> 
>      echo '0;1;2;3;4;5;6;7;8;9;./test.jpg' | w3mimgdisplay

Yes, reads from stdin, writes to stdout. You might also just execute 
w3mimgdisplay and type your commands there. Check the source for command 
line parameters it accepts.

> But as of yet, I haven't actually gotten it to display anything. Does 
> anyone have any clues? Are there some magic incantations that must be 
> performed first? Image-specific numbers that must be generated? What's 
> the trick?

Start by strace'ing w3m?

-- 
~sertaç