diff options
-rwxr-xr-x | ranger/data/scope.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh index 8386eac2..3bf5785a 100755 --- a/ranger/data/scope.sh +++ b/ranger/data/scope.sh @@ -95,6 +95,15 @@ handle_image() { # Image image/*) + local orientation + orientation="$( identify -format '%[EXIF:Orientation]\n' -- "${FILE_PATH}" )" + # If orientation data is present and the image actually + # needs rotating ("1" means no rotation)... + if [[ -n "$orientation" && "$orientation" != 1 ]]; then + # ...auto-rotate the image according to the EXIF data. + convert -- "${FILE_PATH}" -auto-orient "${IMAGE_CACHE_PATH}" && exit 6 + fi + # `w3mimgdisplay` will be called for all images (unless overriden as above), # but might fail for unsupported types. exit 7;; |