Subject: bug#22172: 25.1.50; Wishlist: There should be a way to say to Emacs that is should rescale all images with a certain factor

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 08 Feb 2016 18:25:46 +1100

Lars Ingebrigtsen <[email-masked]> writes:

> And the new variable is called image-scaling-factor.

And this is now implemented, documented and pushed.  Feel free to tweak
the logic.  :-)

This defaults to 'auto, which means that it uses the dubious heuristic
"a character on a 'normal' screen is 10 pixels wide".

(defun image-compute-scaling-factor (scaling)
  (cond
   ((numberp image-scaling-factor)
    image-scaling-factor)
   ((eq image-scaling-factor 'auto)
    (let ((width (/ (float (window-width nil t)) (window-width))))
      ;; If we assume that a typical character is 10 pixels in width,
      ;; then we should scale all images according to how wide they
      ;; are.  But don't scale images down.
      (if (< width 10)
          1
        (/ (float width) 10))))
   (t
    (error "Invalid scaling factor %s" image-scaling-factor))))

I don't have any statistics to back that up, though.  Anybody have any
feelings on the "10" thing?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no