From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Date: Sat, 07 Dec 2024 16:49:41 +0200 Message-ID: <868qsrim4a.fsf@gnu.org> References: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13547"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74725@debbugs.gnu.org To: David Ponce , Alan Third Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 07 15:50:37 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tJw8j-0003P5-6d for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 07 Dec 2024 15:50:37 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tJw8D-0004wW-JL; Sat, 07 Dec 2024 09:50:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tJw8A-0004u5-DK for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2024 09:50:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tJw89-0004t7-TS for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2024 09:50:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=W71A/P3rcldCSpjI3s99955/XVc3vKR9toaDqbi9Xss=; b=cnCR3C06sWtLBfKH8D/sVBcrwQLWKNt8iQSfmBOqgyZJIO6fPyOIdUpONY3XUmefQ300fOWNHKwe/JgpIjAVOGf0NVeKBV878rG+gB+1jwPX1nQVV+6LSQ0SSmxp25z8AqDMBbrqbKplN2BnsnlCABNZAep1n+S/z9lIychYnKpJLRfqmA9Qvdt32KfWVfU7k+vdjgulAfGFqY3c4/7LD9q2GPOBzLdJhXJWdf2BrDwbjGU4m2tyKO7yLbPX4SRq+MUVDKWLAPkmLBrb/o98r0hRSU5GQwv/8nY5JyZJDbPNKj/hNlmZZWxpBLxZLr1A9cxnoHIhsMDHzyDNL8N7Iw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tJw89-0000wI-Or for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2024 09:50:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Dec 2024 14:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs Original-Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.17335829963589 (code B ref 74725); Sat, 07 Dec 2024 14:50:01 +0000 Original-Received: (at 74725) by debbugs.gnu.org; 7 Dec 2024 14:49:56 +0000 Original-Received: from localhost ([127.0.0.1]:46119 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJw84-0000vm-1q for submit@debbugs.gnu.org; Sat, 07 Dec 2024 09:49:56 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:35890) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJw80-0000vT-H4 for 74725@debbugs.gnu.org; Sat, 07 Dec 2024 09:49:53 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tJw7t-0004rm-4w; Sat, 07 Dec 2024 09:49:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=W71A/P3rcldCSpjI3s99955/XVc3vKR9toaDqbi9Xss=; b=YMLnrpQNgAef errxwnUJ1up5tV4g89OLjOgTsF4NiqoEvw/55MumtcdqMHWPCA9mqfY0RZQw/r7WLlxUEzS3F3JZz Bi8SWSAA/SFO3U/B0TbQn/CdTNeZnv57cq76CWKRkDiORB5XUiF2n1cYR0f1rPMBpR5RW02lDkNaB nUQSHUX5Z9j6fLedalhZkFIn+PzSa7ZfbljVFMXMSO4JbnZ0+DHwjETtM9tkTEbytrNWzW8UtaVvx ZSmbPZMO1UCWHSGlRexyzJEB5oBNda1LpLf/S5Yfy96hfClxo/YgFgdy3Zx0b64AzR1DZNGWgjrXG h3qUIFKdLSvNrB1iYplEMA==; In-Reply-To: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> (bug-gnu-emacs@gnu.org) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:296574 Archived-At: > 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" > > 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?