Pascal Bakker

HomeLinksProjectsResume

Preview Images and Pdfs in Ranger

2020-11-17

technology, linux


To enable pdf image previews in ranger. Uncomment the following line 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 preivew, install ueberzug, 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 "mime ^image, sxiv..." line to the top of the of the image section, above inkscape. In the arguements at the end of the line, add "-a" so it can play gifs when you open images. This should improve the quality of life when using ranger.