diff options
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | doc/ranger.1 | 6 | ||||
-rw-r--r-- | doc/ranger.pod | 6 | ||||
-rwxr-xr-x | ranger/data/scope.sh | 8 |
4 files changed, 17 insertions, 7 deletions
diff --git a/README.md b/README.md index 4f8b7b1a..10bdcfb5 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,9 @@ For enhanced file previews (with `scope.sh`): * `img2txt` (from `caca-utils`) for ASCII-art image previews * `w3mimgdisplay`, `ueberzug`, `mpv`, `iTerm2`, `kitty`, `terminology` or `urxvt` for image previews -* `convert` (from `imagemagick`) to auto-rotate images and for SVG previews +* `convert` (from `imagemagick`) to auto-rotate images +* `rsvg-convert` (from [`librsvg`](https://wiki.gnome.org/Projects/LibRsvg)) + for SVG previews * `ffmpeg`, or `ffmpegthumbnailer` for video thumbnails * `highlight`, `bat` or `pygmentize` for syntax highlighting of code * `atool`, `bsdtar`, `unrar` and/or `7z` to preview archives diff --git a/doc/ranger.1 b/doc/ranger.1 index a3d13994..4989e155 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "RANGER 1" -.TH RANGER 1 "ranger-1.9.3" "2021-11-13" "ranger manual" +.TH RANGER 1 "ranger-1.9.3" "2022-02-05" "ranger manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -308,7 +308,9 @@ are automatically used when available but completely optional. \&\f(CW\*(C`w3mimgdisplay\*(C'\fR, \f(CW\*(C`ueberzug\*(C'\fR, \f(CW\*(C`mpv\*(C'\fR, \f(CW\*(C`iTerm2\*(C'\fR, \f(CW\*(C`kitty\*(C'\fR, \f(CW\*(C`terminology\*(C'\fR or \&\f(CW\*(C`urxvt\*(C'\fR for image previews .IP "\-" 2 -\&\f(CW\*(C`convert\*(C'\fR (from \f(CW\*(C`imagemagick\*(C'\fR) to auto-rotate images and for \s-1SVG\s0 previews +\&\f(CW\*(C`convert\*(C'\fR (from \f(CW\*(C`imagemagick\*(C'\fR) to auto-rotate images +.IP "\-" 2 +\&\f(CW\*(C`rsvg\-convert\*(C'\fR (from \f(CW\*(C`librsvg\*(C'\fR) for \s-1SVG\s0 previews .IP "\-" 2 \&\f(CW\*(C`ffmpegthumbnailer\*(C'\fR for video thumbnails .IP "\-" 2 diff --git a/doc/ranger.pod b/doc/ranger.pod index 2484581c..0f1ce0b7 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -234,7 +234,11 @@ C<urxvt> for image previews =item - -C<convert> (from C<imagemagick>) to auto-rotate images and for SVG previews +C<convert> (from C<imagemagick>) to auto-rotate images + +=item - + +C<rsvg-convert> (from C<librsvg>) for SVG previews =item - diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh index 0c003399..864e39ab 100755 --- a/ranger/data/scope.sh +++ b/ranger/data/scope.sh @@ -132,9 +132,11 @@ handle_image() { local mimetype="${1}" case "${mimetype}" in ## SVG - # image/svg+xml|image/svg) - # convert -- "${FILE_PATH}" "${IMAGE_CACHE_PATH}" && exit 6 - # exit 1;; + image/svg+xml|image/svg) + rsvg-convert --keep-aspect-ratio --width "${DEFAULT_SIZE%x*}" "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}.png" \ + && mv "${IMAGE_CACHE_PATH}.png" "${IMAGE_CACHE_PATH}" \ + && exit 6 + exit 1;; ## DjVu # image/vnd.djvu) |