From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id iGVEI35tVGEYhQAAgWs5BA (envelope-from ) for ; Wed, 29 Sep 2021 15:43:26 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id IBLNHn5tVGGXMwAAbx9fmQ (envelope-from ) for ; Wed, 29 Sep 2021 13:43:26 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2DF8C32DB4 for ; Wed, 29 Sep 2021 15:43:26 +0200 (CEST) Received: from localhost ([::1]:59386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZrp-00060D-9I for larch@yhetil.org; Wed, 29 Sep 2021 09:43:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZpk-0004r3-Ny for emacs-orgmode@gnu.org; Wed, 29 Sep 2021 09:41:16 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:56031) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZph-0004FR-Sx for emacs-orgmode@gnu.org; Wed, 29 Sep 2021 09:41:16 -0400 Received: by mail-pj1-x102c.google.com with SMTP id pg10so1272750pjb.5 for ; Wed, 29 Sep 2021 06:41:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:user-agent:message-id:mime-version; bh=eqKl/O+Y3xcodHg/Er4ERaGqZNj5lnqoNMIjrNE357Q=; b=SiQz04BK92X3CJNkaBLRuxb18OsQrX94jWa4F1ZZz15oTMkrbroXo5K3cS29forIBA HyLd+0Jp0j5tJA0qCVsB770Hvs8unvyIQbcz/9O1TZJ22RRPJonBWOccFo1i8tzK4k1S AmYAp4qioDVgVdh7Wdq6EDiwEk0wM0wBsaJNPjT+V8GWBS/4s/RvJUAkpsRXGVlZjnFp zChciyQOjPIl1ynXpEAD0+3l9glR1AtwoIBgShdfnwRgQ3f+RUzL9dnyEqQQl7Rb8JNY rI2aCJxZsEEx4O1XxA2TKCyv2T0K/4hHB0Of0LEVMS6tsMaAqYvOMmUKnHqgaIqwM3My OuAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:user-agent:message-id :mime-version; bh=eqKl/O+Y3xcodHg/Er4ERaGqZNj5lnqoNMIjrNE357Q=; b=P10Xz3LZ4ARDu7BFqhJTIxqY7a4K4mcSfXj33JRe+uetfw8RKszbQJY8Hsz1AjTyri jVK16N2SszPCy8oPnRfD4OqiE0bOSJO3tN4JB532ZEkpdOqtjQbS+2mR4HT9667eZQ+s VZVzvPSxT67bGvRnF3KnQEKmDO/FOxVuqKz4J3dDAsBf0uQ+HFCi3ReZoxBUK01LjCkA cw60ANuAtw5O+cNJEO3fP8FoFBTBy1MzOlcHR3IT5DZyl82j9LzONxD44KlfnlkLgwCM 3sGARvaNHLhiTmOxtm8OzvX4JyU+Zh0s3WcEHbJLo9dT+8LmS07FWXy8QRy7xcssj1zW xGFA== X-Gm-Message-State: AOAM532eVmBZwD+d0RwYnMsFlop+aIBByybCu8L2yI/M3veaWvUxQq7s 4T5RgkMjhUhyvjiz3dg2LwKoKNGyp88= X-Google-Smtp-Source: ABdhPJynajqkluwCvxHckV0xi5nHzibbDN4hLKMHg4hk58T/b+TT3xPObF+14oloG/Mq2IktOFwsvA== X-Received: by 2002:a17:90a:540a:: with SMTP id z10mr49679pjh.115.1632922872044; Wed, 29 Sep 2021 06:41:12 -0700 (PDT) Received: from localhost (61-245-128-160.3df580.per.nbn.aussiebb.net. [61.245.128.160]) by smtp.gmail.com with ESMTPSA id 23sm3029611pgk.89.2021.09.29.06.41.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:41:11 -0700 (PDT) From: Timothy To: Org-Mode Mailing List Subject: [PATCH] Prevent displayed images from being re-scaled Date: Wed, 29 Sep 2021 21:33:34 +0800 User-agent: mu4e 1.6.5; emacs 28.0.50 Message-ID: <87bl4bcxe3.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=tecosaur@gmail.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1632923006; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=eqKl/O+Y3xcodHg/Er4ERaGqZNj5lnqoNMIjrNE357Q=; b=JGG9v3kH+PNvAXl3LI/hDP7yyb4Vzlo06H0gVnburrGB9IXiz7ke7V4f+c81bVE8vGlFr7 2R96+igttv5e4GbgDy0pqIw0ny6i10FzDf4gI98V9eBpkuAiGPyKoe2KpjZa8sJR3bxbyf Z1dqiL9yPebj8LIRHAHM/O25BdKhxnZ6zcSl61bjnM7Ppfmrv99glGDfteIJKK25Lzh25M S/KA3R925Okaqsh9vCwFV6CObkJVS320QBByQX4YVzOcTNE0joRyiiO1DrJ/7fBUU631wz +a6+H3KodD18ynm5EUyw/WT2c2qF8w7BDVYkYgrChRKhMLw1O7sMVfY8c+Iklg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632923006; a=rsa-sha256; cv=none; b=LptYzGcbJg7BrI4QuIGCtPQRTPXl4EQAuPeiWIkb6H82w/eT17BpNdQx4fgbKfDAs0XbBu CM3ae3Te7F+5+cPCUFwxzkio/lFv2lyVw407YAuczWYSIbGdfanqJoYvqFdHtWYHVx+hqs XRT/+wSNHlvCROFCOuHmOeK/WrPgpzHv0NN6ZKOnOWY+o0gcb/9efdzrb9OYdbIWPdz7PQ oX5lkSi0e3848st96L5LaZSkxj2b9P+iwELmq7DYJTt3fbRKLtmQAu5EVukjedzoF2VDI6 LQqiCmVskxhrOpXN6BoyGpBBfaNhG56RU2ZAVZuCs2NyEGMjxgscpY13ZFHX2w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=SiQz04BK; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -4.00 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=SiQz04BK; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 2DF8C32DB4 X-Spam-Score: -4.00 X-Migadu-Scanner: scn1.migadu.com X-TUID: rauu9xY4/jem --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, After my last patch providing support for proportional image width attribut= es (e.g. 70% of the text width), I noticed that the results looked slightly of= f. Investigating the code lead me to `create-image' which takes the liberty of re-scaling images based on your default font size. As you might imagine, th= is can be problematic when if you say determine that image should be 70% of the text width, the text width is 1000px, and so the image should be 700px wide= =E2=80=94 but upon being told to make the image 700 pixels wide `create-image' decide= s to make it say 850 pixels wide. I personally found that images >~80% wide were being made wider than the buffer, which isn=E2=80=99t good. To make image width behave as expected, we can just specify `:scale 1' when calling `create-image', and that will stop it from re-interpreting the `:wi= dth' specification. See the patch attached. All the best, Timothy --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-Don-t-change-image-size-based-on-font-size.patch >From 9c34dd6aba62d734f6ae9aecaffa76a0250bf495 Mon Sep 17 00:00:00 2001 From: TEC Date: Wed, 29 Sep 2021 21:29:27 +0800 Subject: [PATCH] org: Don't change image size based on font size * lisp/org.el (org--create-inline-image): When `create-image' is called without the :scale parameter, the image size is expanded based on the default font size (if it is larger than 10px). When displaying images with a specified width in Org buffers, either in pixels or proportional to the text width, this width should not be modified according the to font size. Giving a :scale parameter of 1 prevents this font-size based rescaling. --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 2ec6566c0..0e7f926f0 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -16518,7 +16518,7 @@ (defun org--create-inline-image (file width) width 'imagemagick) remote? - :width width)))) + :width width :scale 1)))) (defun org-display-inline-images (&optional include-linked refresh beg end) "Display inline images. -- 2.33.0 --=-=-=--