diff options
author | Wojciech Siewierski <wojciech.siewierski@onet.pl> | 2017-12-06 12:36:05 +0100 |
---|---|---|
committer | Wojciech Siewierski <wojciech.siewierski@onet.pl> | 2017-12-06 13:24:52 +0100 |
commit | 971f135c0d49c8418369d894d5496461b96db9de (patch) | |
tree | 87fedf80d7fdf14027185142e1ed141c2c36f009 | |
parent | 5149d6a5a03ec0dc831c75a895f6b9b2ef8efe68 (diff) | |
download | ranger-971f135c0d49c8418369d894d5496461b96db9de.tar.gz |
Rotate the images according to the EXIF data
Fixes #927.
-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;; |