Subject: 31.0.50; image-scaling-factor is ignored by create-image

From: David Ponce <[email-masked]>
Date: Sat, 7 Dec 2024 13:41:37 +0100

Hello,

After more investigation I found the issue is not in image.el, but is due
to image caching.

If I flush the image cache when I change the value of `image-scaling-factor'
the result is as expected:

(let* ((image-scaling-factor 2.0)
        (image (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg")))))
   (image-flush image t)
   (image-size
    (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg")))
    t))
(96 . 96)

;; Image is used from cache, size is not updated.
(let* ((image-scaling-factor 3.0)
        (image (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg")))))
   ;; (image-flush image t)
   (image-size
    (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg")))
    t))
(96 . 96)

;; Image not in cache, size is updated.
(let* ((image-scaling-factor 3.0)
        (image (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg")))))
   (image-flush image t)
   (image-size
    (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg")))
    t))
(144 . 144)

Thanks!