From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Re: Images :scale and :width/:height relation Date: Sun, 03 Sep 2023 15:37:11 +0200 Message-ID: <8734zvcr94.fsf@ledu-giraud.fr> References: <87ledqcgss.fsf@ledu-giraud.fr> Reply-To: Manuel Giraud Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10159"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel To: Alan Third Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Sep 03 15:38:18 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 1qcnIu-0002Pd-6S for ged-emacs-devel@m.gmane-mx.org; Sun, 03 Sep 2023 15:38:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcnI4-0003s2-BR; Sun, 03 Sep 2023 09:37:24 -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 1qcnI2-0003rn-8m for emacs-devel@gnu.org; Sun, 03 Sep 2023 09:37:22 -0400 Original-Received: from ledu-giraud.fr ([51.159.28.247]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qcnHz-0003cL-FP for emacs-devel@gnu.org; Sun, 03 Sep 2023 09:37:22 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=HcTra4LD kMZynokJJj9KQ3Mydzp+/pApeBAW3GlECTQ=; h=date:references:in-reply-to: subject:cc:to:from; d=ledu-giraud.fr; b=u0dZpd6VPFb55fhxHiHc6mnXDEMplO vWHWMnnPs++qYiBhNUH+zlJS362KSGQeseQol4PyCp14s8Cc1PfDGWDQ== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=HcTra4LDkMZynokJ Jj9KQ3Mydzp+/pApeBAW3GlECTQ=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=GtQfwN/02Dl2gnhHAEAyVrGH1WH+x1eKBME5E7 wnUiWJpM6LRjdohjvKCTWtEz1oLCAx6cMHUyP89Zxn3Cqnn0gRFdOsjKCxRhrIerwvbqc5 bA1cyI/GXK7xA3K5J3F5pyCJFlPGPuG54iH8Cb32nXSqY1JRS2uZooZKwmJNvPCoxGYKNw W0jtK6pLFUkUM9PfwQA7cOV31g5uw1t0kJHgjJz+22mb143unjQA93ImyDW9kVPIApmcgH uEqh5F3zvc0DVZm6mbZA4h4qlUsOJwCAzHUnqLtTMqnSGx5RsVQpKl81e40KDORjsLYEpm ZckEHLy3IRf8Ja/kIeOZnIyw== Original-Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id fdc1dedf (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 3 Sep 2023 15:37:14 +0200 (CEST) In-Reply-To: (Alan Third's message of "Fri, 1 Sep 2023 21:57:38 +0100") Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_PASS=-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:309975 Archived-At: Alan Third writes: > On Fri, Sep 01, 2023 at 12:46:11PM +0200, Manuel Giraud via Emacs develop= ment discussions. wrote: >> Hi, >>=20 >> 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. >>=20 >> In "(elisp) Image Descriptors", it is said that: >>=20 >> If both =E2=80=98:scale=E2=80=99 and =E2=80=98:height=E2=80=99/=E2= =80=98:width=E2=80=99 are specified, the >> height/width will be adjusted by the specified scaling factor. >>=20 >> 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. Ok. So with both a :width and a :scale, each does its scaling. From the info, I thought that a :scale set would then modify :width accordingly. >> Wouldn't it be a good thing if 'create-image' return a >> =C2=AB=C2=A0normalized=C2=A0=C2=BB 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. Hum, I see. > 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. I should have a look their then. But Emacs does not have a way of asking "what are the dimensions of this image" without loading it into its cache? --=20 Manuel Giraud