15

I am using a Mac (El Capitan), and trying to use w3m. But I don't see images when browsing pages.

My question is: I want to view inline images in w3m, but don't find a way to do so.

I have been told that w3m can display inline images, and seen some video examples. But all the tutorials I found use Linux or the like, and I can't seem to make w3m display inline images.

I opened w3m in a terminal (either xterm or iterm2), and pressed o and set the display inline image option to yes, and re-launches w3m, but nothing happens.

Some say that one should install w3m-img, but I cannot find a package named as such. Others say that one should enable frame buffer; however, I don't know how to do that either.

Any help or reference is sincerely appreciated.

P.S.
In item2 I can display images on the terminal, but, when using w3m, still no images appear.

1
  • 1
    Not an answer because it doesn't use w3m, but browsh, will attempt to render images using text so doesn't require quite so much terminal config. It does use headless firefox for rendering, so not a lightweight solution. brow.sh Nov 25, 2020 at 10:11

2 Answers 2

10

w3m with inline images on macos

Things you need to make this happen on macos:

1. Terminal emulator that supports sixel

iTerm2 recently added sixel support for viewing inline images. You'l need iterm 3.3 or later, which at time of writing is in beta, available in the test releases section of the downloads page.

2. Utility for converting images to sixel format

I used img2sixel.

  git clone https://github.com/saitoha/libsixel # Download the source code
  pushd libsixel # switch to the directory containing the source
  ./configure # This generates compilation settings for your OS
  make # Compile the program
  export SIXEL_DIR=${PWD} # Store current directory for reference later

  # Test it
  ./converters/img2sixel images/snake.png #should display in your terminal :)

3. w3m build with sixel support

Follow the sixel readme in tats/w3m

  popd # Don't clone w3m within the img2sixel dir
  git clone https://github.com/tats/w3m
  pushd w3m
  ./configure --enable-image
  make

  # Test it 
  W3M_IMG2SIXEL="${SIXEL_DIR}/converters/img2sixel" ./w3m -sixel -o display_image=1 google.com

4. Install

If the above test worked, then the compiled img2sixel and w3m binaries can be copied into a dir referenced by $PATH, eg /usr/local/bin so you don't have to reference them explicitly each time you start w3m.

8
  • Thanks for the detailed answer. It will be of use when I want to use w3m again.
    – awllower
    Jun 28, 2019 at 13:21
  • should be "pushd w3m" Jun 29, 2019 at 13:17
  • 2
    In ubuntu, now you can just use sudo apt install w3m-img
    – ton
    Sep 16, 2020 at 22:26
  • 1
    Thank you! For me though, on Mac Catalina 10.15.6, step 3 > configure should be changed to ./configure --enable-image --with-imagelib=imlib2. Then it worked. Oct 24, 2020 at 23:08
  • 1
    @mellow-yellow I am using Mojave10.14.6, the test worked for me with the --with-imagelib=imlib2 (didn't work without it), but w3m doesn't show the images while browsing even after I put the binaries in /usr/local/bin (which I double-checked is in my $PATH). Any guess what might be going wrong? Just in case it might be shell dependent, I tried in all the three shells I have used -- BASH, zsh, and fish. (Moreover, I can verify that the binaries are in the path, for example, img2sixel image.png and w3m wikileaks.org both work from the home directory.)
    – user256573
    Feb 9, 2021 at 6:27
3

From https://ilyakava.tumblr.com/post/616300103655948288/terminal-web-browser-with-images-macos:

  1. First, you’ll have to use iTerm 3.3 or later.

  2. Install the image converter for the terminal:

    brew install libsixel
    
  3. Install w3m:

    brew install w3m
    
  4. There is no image support in w3m by default. To enable it:

    1. Run:

      brew edit w3m
      
    2. Change --disable-image to --enable-image and save. You may add a line --with-imagelib=imlib2 if it doesn't work. Then:

      brew reinstall --build-from-source w3m
      
  5. Launch w3m with:

    W3M_IMG2SIXEL=/usr/local/bin/img2sixel w3m -sixel -o display_image=1 google.com
    

Scrolling with the mouse lags and it is better to page up/down by holding the fn key with up and down arrows. Press Shift+h for the help menu.

You must log in to answer this question.

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