I like the image-preview in ranger, but I also like my terminal transparent.

Is there really no way to get the image-preview work with w3m and transparent background? (I'm willing to change my terminal-emulator if that's necessary, currently urxvt)


I have a transparent terminal that works with ranger's image preview. I use termite (terminal emulator) and compton (compositor) for transparency (a nice combo when you use i3wm).

Here's the result:

enter image description here

The only problems I had were with tmux (images are displayed, but not always at the right position and sometimes the terminal needs to be refreshed).

Note that the text and the image are also transparent since transparency is handled by compton. This only works if you don't add too much transparency, else you need a terminal emulator that handles transparency and works with this feature (I tried with terminator and I did not work for instance, same for urxvt). 85% opacity gives me some transparency and good readability, so this setup works for me.


True transparency is supported once again in termite, but it suffers from the same issues as urxvt when you enable transparency (failed to execute w3mimgdisplay error, cf. @slm's answer).

| improve this answer | |
  • It was so simple^^ just put opacity-rule = ["85:class_g = 'Termite'"]; in the compton config file :-) thank's I couldn't be happier – makim Aug 17 '14 at 15:40
  • Oh just one Question, how did you get the text non-transparent? – makim Aug 17 '14 at 17:24
  • The text follows the same transparency rule since compton has no way to distinguish text from the rest, it only handles windows. If you want way more transparency, then you need a terminal that takes care of transparency itself (like terminator) while working with this feature (terminator doesn't iirc). In my case, I want a dark background for readability so this setup works pretty well for me, and it is much lighter than alternatives I used before. – BenC Aug 25 '14 at 11:48
  • Also, since I'm using vim, I have an extra compton rule that sets the opacity to 100% when I'm editing files in vim. – BenC Aug 25 '14 at 11:56
  • How ir-relevant is this one: lists.gnu.org/archive/html/ranger-users/2013-06/msg00003.html? Will there be a working image preview in ranger within from Konsole for example? – Nikos Alexandris Aug 30 '16 at 11:18

Not sure what terminal you're using but if it's using a bit-depth of 32 or higher then it won't work.

excerpt - Images in terminal

Side note: w3m can't render images in urxvt, if the depth is 32. That means that you can't render images on a transparent background. Be sure that you comment the line URxvt*depth: 32 in your ~/.Xresources.

This thread also discussed it as well: - w3m/ranger images don't work on urxvt.


It doesn't work with transparent terminals. I always make a shortcut for a "special ranger terminal" that has transparency disabled.

| improve this answer | |
  • 1
    any update on this issue as of today? at least an alternative to w3mimagedisplay? – villasv Aug 21 '16 at 15:46
  • 1
    Ranger 1.7.2 with urxvt 9.22 transparent has image preview. That's with ranger default configuration set preview_images true, set preview_images_method w3m and urxvt Native transparency. It even works in tmux but only for an instant :) – tuk0z Aug 30 '16 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.