← Back home

Preview Images and PDFs in Ranger

Published on Nov 17th, 2020

To enable PDF image previews in Ranger, uncomment the following block in ~/.config/ranger/scope.sh:

application/pdf)
     pdftoppm -f 1 -l 1 \
              -scale-to-x "${DEFAULT_SIZE%x*}" \
              -scale-to-y -1 \
              -singlefile \
              -jpeg -tiffcompression jpeg \
              -- "${FILE_PATH}" "${IMAGE_CACHE_PATH%.*}" \
             && exit 6 || exit 1;;
            

Additionally, if you want to view images in Ranger previews, install ueberzug and add the following lines to your rc.conf:

set preview_images true
set preview_images_method ueberzug
            

Make sure you have sxiv installed. Then, in rifle.conf, move the line mime ^image, sxiv... to the top of the image section, above Inkscape. At the end of the line, add -a to allow GIF playback when opening images. These changes will improve your quality of life when browsing files with Ranger.

← Back home