16

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.

0

4 Answers 4

11

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
    Commented Jun 28, 2019 at 13:21
  • should be "pushd w3m" Commented Jun 29, 2019 at 13:17
  • 2
    In ubuntu, now you can just use sudo apt install w3m-img
    – ton
    Commented 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. Commented 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
    Commented 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.

0

w3m has support for the Iterm2 image protocol. To enable it you can set the image protocol in your w3m config:

inline_img_protocol 3
imgdisplay iterm2
0

w3m should have enabled images. That's why it should be rebuilded from source. But brew has a bug and you need to copy formula before building. The following steps are tested on Apple M1 (on Intel you probably have other path to homebrew):

brew install iterm2 w3m libsixel
open /Applications/iTerm.app
# without copying formula brew reverts the changes and builds without image support
cp /opt/homebrew/opt/w3m/.brew/w3m.rb .
# use vim or any other editor
vim ./w3m.rb
# delete line: --disable-image
brew reinstall --build-from-source --formula ./w3m.rb
w3m -sixel google.com
# press o:
#   Display inline images -> YES -> OK
#   Run external viewer in background -> YES -> OK
2
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jan 12 at 10:38
  • @Community fixed
    – user514619
    Commented Feb 21 at 10:35

You must log in to answer this question.

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