From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: Re: Images :scale and :width/:height relation Date: Fri, 1 Sep 2023 21:57:38 +0100 Message-ID: References: <87ledqcgss.fsf@ledu-giraud.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33289"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Manuel Giraud Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 01 22:58:52 2023 Return-path: Envelope-to: ged-emacs-devel@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 1qcBEC-0008UD-AE for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Sep 2023 22:58:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcBDB-0006H7-1J; Fri, 01 Sep 2023 16:57:49 -0400 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 1qcBD9-0006Gk-HL for emacs-devel@gnu.org; Fri, 01 Sep 2023 16:57:47 -0400 Original-Received: from dane.soverin.net ([2a10:de80:1:4092:b9e9:2294:0:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qcBD7-0000bi-3w for emacs-devel@gnu.org; Fri, 01 Sep 2023 16:57:47 -0400 Original-Received: from smtp.soverin.net (c04smtp-lb01.int.sover.in [10.10.4.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dane.soverin.net (Postfix) with ESMTPS id 4Rcr2W2k9Lz2xd0; Fri, 1 Sep 2023 20:57:39 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.100]) by soverin.net (Postfix) with ESMTPSA id 4Rcr2W0gZZzcj; Fri, 1 Sep 2023 20:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1693601859; bh=/69vvgUUea+7W69aDCxqIOhc4K2f2OH+TKFeT6n0s04=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ov8F7KgFuxwDqXtMfVASP/KS7akANJxxSbpo8QGTYNFiuHFD+Empk/ZrVlopfUI/c 999UmVxiemdko98T1464vrNAzZzb6inWMDb71c/NQnvqPaLJagNEHcVncfKiBzxZhT vS00uoHjro8bA5YEz9UUqh56edVda8dLVCX+k+vdBBxUk93PperCVqMj0lL87GniYu 3nLYVKRn7xrWmbIEiWt/kpeKtP/qVSs9zRcT4uWqNkTsnLXedcFpdHrNYZGWTHSf4V KfhlH3sA+HhV/30O4BW60jGlQDAObyGuj7GsAFHwFjsjjeDxUDF9ZGTHUhwLmyT4eq CwZt+6beifQtA== Original-Received: from alan by faroe.holly.idiocy.org with local (Exim 4.96) (envelope-from ) id 1qcBD0-000ELZ-0H; Fri, 01 Sep 2023 21:57:38 +0100 X-Soverin-Authenticated: true Mail-Followup-To: Alan Third , Manuel Giraud , emacs-devel Content-Disposition: inline In-Reply-To: <87ledqcgss.fsf@ledu-giraud.fr> Received-SPF: pass client-ip=2a10:de80:1:4092:b9e9:2294:0:1; envelope-from=alan@idiocy.org; helo=dane.soverin.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:309835 Archived-At: On Fri, Sep 01, 2023 at 12:46:11PM +0200, Manuel Giraud via Emacs development discussions. wrote: > Hi, > > For the need of bug#65581, I'd like to have access to the current scale > of an image. But it seems that this one does not always reflect > reality. For instance, you can have a image with an original width of > 500 scaled down to a width of 100 (by mean of the :width keyword) and > its :scale keyword will still be 1. > > In "(elisp) Image Descriptors", it is said that: > > If both ‘:scale’ and ‘:height’/‘:width’ are specified, the > height/width will be adjusted by the specified scaling factor. > > But it does not seems to work the other way around. I think you've maybe misunderstood. If you set :width 100, and :scale 2, then the actual image will have a width of 200. The image spec will still say :width 100 :scale 2. > Wouldn't it be a good thing if 'create-image' return a > « normalized » image spec where the :width, :height and :scale are > filled and kept in sync? It would probably be nice, but it's not that easy as you can't work out the scale, given a desired width or height, without loading the image first to get the real width, and Emacs only loads the image at display time. IIRC the likes of eww will actively load an image and then get the size and set the scale accordingly. Perhaps that sort of behaviour should be made available generally. -- Alan Third