GNU bug report logs - #74725
31.0.50; image-scaling-factor is ignored by create-image

Previous Next

Package: emacs;

Reported by: David Ponce <da_vid <at> orange.fr>

Date: Sat, 7 Dec 2024 12:15:02 UTC

Severity: normal

Found in version 31.0.50

Done: Alan Third <alan <at> idiocy.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: David Ponce <da_vid <at> orange.fr>, Alan Third <alan <at> idiocy.org>
Cc: 74725 <at> debbugs.gnu.org
Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image
Date: Sat, 07 Dec 2024 16:49:41 +0200
> Date: Sat, 7 Dec 2024 13:13:58 +0100
> From:  David Ponce via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> While working with images, I found what seems an issue to me with
> `create-image' which unconditionally set the :scale image property to
> 'default' when not specified, ignoring the value of the option
> `image-scaling-factor'.
> 
> Here is an illustration:
> 
> (let ((image-scaling-factor 1.0))
>     (image-size
>      (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg")))
>      t))
> => (63 . 63)
> 
> (let ((image-scaling-factor 2.0))
>     (image-size
>      (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg")))
>      t))
> => (63 . 63)
> 
> (image-size
>    (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 1)))
>    t)
> => (48 . 48)
> 
> (image-size
>    (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 2)))
>    t)
> => (96 . 96)
> 
> You can replace `image-size' with `insert-image' and observe the same.
> 
> Here is a simple patch which fix the issue for me:
> 
> diff --git a/lisp/image.el b/lisp/image.el
> index ce97eeb3ca1..2c1e865c336 100644
> --- a/lisp/image.el
> +++ b/lisp/image.el
> @@ -536,7 +536,9 @@ create-image
>                            file-or-data)
>                      (and (not (plist-get props :scale))
>                           ;; Add default scaling.
> -                        (list :scale 'default))
> +                        (list :scale (if (numberp image-scaling-factor)
> +                                         image-scaling-factor
> +                                       'default)))
>   	           props)))
>         ;; Add default smoothing.
>         (unless (plist-member props :transform-smoothing)

AFAIU, this is supposed to be taken care of in image.c.

Alan, any ideas why this doesn't seem to work?




This bug report was last modified 146 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.