Function: image-compute-scaling-factor

image-compute-scaling-factor is a byte-compiled function defined in image.el.gz.

Signature

(image-compute-scaling-factor SCALING)

Source Code

;; Defined in /usr/src/emacs/lisp/image.el.gz
(defun image-compute-scaling-factor (scaling)
  (cond
   ((numberp scaling) scaling)
   ((eq scaling '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" scaling))))