GNU bug report logs -
#41886
27.1; Rotated image doesn't fit to window height
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Tue, 16 Jun 2020 00:04:01 UTC
Severity: normal
Tags: fixed, patch
Fixed in version 27.1
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41886 in the body.
You can then email your comments to 41886 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#41886
; Package
emacs
.
(Tue, 16 Jun 2020 00:04:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> linkov.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 16 Jun 2020 00:04:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Version: 27.1
Tags: patch
I found a bug in image-mode on emacs-27.
Using the default value 't' of 'image-transform-resize'
(that means to fit the image to the window height and width),
when an image has exif-orientation 90 and visited in image-mode,
it's rotated, but doesn't fit to the window height,
only the upper half of the image is displayed.
The patch that fixes this problem:
[image-mode-fit-rotated-image.patch (text/x-diff, inline)]
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index b82c066918..019f6e20ce 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -810,8 +810,12 @@ image-toggle-display-image
filename))
;; If we have a `fit-width' or a `fit-height', don't limit
;; the size of the image to the window size.
- (edges (and (eq image-transform-resize t)
- (window-inside-pixel-edges (get-buffer-window))))
+ (edges (when (eq image-transform-resize t)
+ (window-inside-pixel-edges (get-buffer-window))))
+ (max-width (when edges
+ (- (nth 2 edges) (nth 0 edges))))
+ (max-height (when edges
+ (- (nth 3 edges) (nth 1 edges))))
(type (if (image--imagemagick-wanted-p filename)
'imagemagick
(image-type file-or-data nil data-p)))
@@ -827,14 +831,18 @@ image-toggle-display-image
(ignore-error exif-error
(exif-parse-buffer)))
0.0)))
+ ;; Swap width and height when changing orientation
+ ;; between portrait and landscape.
+ (when (and edges (memq (truncate image-transform-rotation) '(90 270)))
+ (setq max-width (prog1 max-height (setq max-height max-width))))
;; :scale 1: If we do not set this, create-image will apply
;; default scaling based on font size.
(setq image (if (not edges)
(create-image file-or-data type data-p :scale 1)
(create-image file-or-data type data-p :scale 1
- :max-width (- (nth 2 edges) (nth 0 edges))
- :max-height (- (nth 3 edges) (nth 1 edges)))))
+ :max-width max-width
+ :max-height max-height)))
;; Discard any stale image data before looking it up again.
(image-flush image)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#41886
; Package
emacs
.
(Tue, 16 Jun 2020 14:47:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 41886 <at> debbugs.gnu.org (full text, mbox):
> From: Juri Linkov <juri <at> linkov.net>
> Date: Tue, 16 Jun 2020 02:27:31 +0300
>
> I found a bug in image-mode on emacs-27.
>
> Using the default value 't' of 'image-transform-resize'
> (that means to fit the image to the window height and width),
> when an image has exif-orientation 90 and visited in image-mode,
> it's rotated, but doesn't fit to the window height,
> only the upper half of the image is displayed.
> The patch that fixes this problem:
Thanks, this is okay for the release branch.
Added tag(s) fixed.
Request was from
Juri Linkov <juri <at> linkov.net>
to
control <at> debbugs.gnu.org
.
(Tue, 16 Jun 2020 23:00:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 27.1, send any further explanations to
41886 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net>
Request was from
Juri Linkov <juri <at> linkov.net>
to
control <at> debbugs.gnu.org
.
(Tue, 16 Jun 2020 23:00:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 15 Jul 2020 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 26 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.