Mutt: view images in the Mutt e-mail client

I think that if you want to learn something, the best way is to complicate yout life as much as possible!

I would like to learn the essence of the GNU/Linux operating systems and the Richard Stallman’s philosophy, so I try to delete all it has a GUI…using the CLI every time I need to do something.

So I use Mutt as text-based email client for my Arch Linux operating system.

But many emails have photos and images as attachments and it is very complicated to watch them at the terminal.

The solution has been found by Click on this link to follow the original receipe, otherwise I reported the needful steps in this post.

Firstly you have to install the w3m-img package (the package w3m is sufficient for Arch Linux distro):

yaourt -S w3m

Then create the bash script

#! /bin/sh

#### Determine size of Terminal
height=`stty  size | awk 'BEGIN {FS = " "} {print $1;}'`
width=`stty  size | awk 'BEGIN {FS = " "} {print $2;}'`

### Display Image / offset with mutt bar
echo -e "2;3;n0;1;210;20;$((width*7-250));$((height*14-100));0;0;0;0;$1n4;n3;" |  /usr/lib/w3m/w3mimgdisplay &

As written in the linked web-site, this script determines first the height and width of the running terminal.

The last step is add the following command in your mailcap.mutt located in your .mutt directory:

image/*; ~/PATH/YOUR/SCRIPT/ %s ; copiousoutput

Now, when you will open an image in the mutt e-mail client, you will see it directly without save nothing.

About Francesco Serafin

I am a PhD student at the Department of Civil, Environmental and Mechanical Engineering at the University of Trento. My two greatest loves: Computer Science and Water (take three with my Lenovo!:D). As a result, the aim of my life is to make both passions coexist. My gpg public key available at

Leave a Reply

Your email address will not be published.