How to preview images in Ranger

Ranger is a great console tool to explore directories and files. You can find the instructions to install and configure it in this post. As you explore files in the center column, Ranger displays a preview of the file contents in the right column. If the file is an image, then Ranger displays a color ASCII version of the image using the Caca library.

However, if you use XTerm or a terminal with similar capabilities, Ranger can show an actual image preview with full color and pixels! Remember that this works only on XTerm or similar terminals.

To preview images like this, Ranger requires the w3mimgdisplay program. You can get it by installing:

$ sudo apt install w3m-img

After this, you need to set the preview_images option to true in the .config/ranger/rc.conf file. You will have this file only if you followed the instructions given above during Ranger installation.

Once you have done this, open an XTerm and enjoy full-color image previews! Note that this did not work in RXVT for me 🙂

Tried with: W3m-Img 0.5.3-15, Ranger 1.6.0 and Ubuntu 14.04

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.