unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#74725: 31.0.50; image-scaling-factor is ignored by create-image
@ 2024-12-07 12:13 David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-12-07 12:41 ` David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-12-07 14:49 ` Eli Zaretskii
  0 siblings, 2 replies; 15+ messages in thread
From: David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-07 12:13 UTC (permalink / raw)
  To: 74725

Hello,

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)


Thanks!


In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
  3.24.43, cairo version 1.18.0) of 2024-12-02
Repository revision: 8cd4ab7abde87ac04e05442196b4646ab46df9a7
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12014000
System Description: Fedora Linux 40 (KDE Plasma)

Configured using:
  'configure --with-native-compilation=no
  PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
   value of $LC_TIME: fr_FR.utf8
   value of $LANG: fr_FR.UTF-8
   locale-coding-system: utf-8-unix






^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-12-22  6:48 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-07 12:13 bug#74725: 31.0.50; image-scaling-factor is ignored by create-image David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-07 12:41 ` David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-07 14:49 ` Eli Zaretskii
2024-12-07 15:49   ` Alan Third
2024-12-07 16:21     ` Eli Zaretskii
2024-12-07 16:32       ` David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-07 16:27     ` David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-07 16:45       ` Eli Zaretskii
2024-12-08  0:01         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08  6:03           ` Eli Zaretskii
2024-12-08  8:03             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08 12:15               ` Eli Zaretskii
2024-12-21  9:14                 ` Eli Zaretskii
2024-12-22  0:26                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-22  6:48                     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).