Subject: image-transform-resize has inconsistent semantics wrt scaling up/down

From: Stefan Kangas <[email-masked]>
Date: Wed, 3 Nov 2021 21:14:58 -0700

I find the semantics of `image-transform-resize' inconsistent.  That
also goes for `image-auto-resize' and the corresponding functions.

"Fit height" and "fit width" both scales an image up or down, but "fit
height and width" only scales an image down.  Is that intentional?

I would have expected that they all scale in the same way, i.e. they
should all either scale up or down, or scale down only, or scale up
only.

My preference is that they scale both up or down, no matter which kind
of fitting you ask for.  The below diff seems to achieve what I want.
However, I'm not sure if the semantics should be changed in this way,
as I don't know if the old semantics were intentional or not.

diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 4a326cdc69..97efd8254d 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -880,7 +880,7 @@ image-toggle-display-image
                                   :format (and filename data-p))
 		  (create-image file-or-data type data-p :scale 1
 				:max-width max-width
-				:max-height max-height
+                                :height max-height
                                 ;; Type hint.
                                 :format (and filename data-p))))