* feature request: easy embedding of images @ 2023-02-19 0:22 Alexis Gallagher 2023-02-20 19:20 ` Russell Adams ` (3 more replies) 0 siblings, 4 replies; 11+ messages in thread From: Alexis Gallagher @ 2023-02-19 0:22 UTC (permalink / raw) To: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1472 bytes --] Hello, my fellow org-mode lovers, This is a feature request — or failing that, a request for advice on a settings configuration which could produce this functionality now. I wish org-mode had the ability to attach images to notes, display them inline, and have that work well. By “work well” I mean a few specific things: • the image is automatically resized to maintain aspect ratio and fit horizontally with a civilized margin, so that I can resize my emacs window without the image disappearing or swamping the other content. • you can still scroll the window one line height unit at a time, without the entire image being scrolled as if it were one giant line, breaking scrolling, as seems to happen on my emacs (version 28.x on Linux) • drag and drop, so I can add the image by dragging it in, for instance from a screenshot tool or from an image on a web page. • sensible defaults for storing the images bundled with notes and keeping the two associated, so that I don't subsequently live in fear of ever moving my org files Why is this valuable, to me at least? I use org to take notes all day, during meetings, on reading matter, in the development of my own thoughts. Embedding images would let me collect every kind of resource I can't reproduce by typing or copy and pasting text — photos of slides during presentations, photos of whiteboard, key snippets from websites, handwritten notes and equations, etc.. Alexis [-- Attachment #2: Type: text/html, Size: 2774 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: feature request: easy embedding of images 2023-02-19 0:22 feature request: easy embedding of images Alexis Gallagher @ 2023-02-20 19:20 ` Russell Adams 2023-02-20 21:24 ` Jude DaShiell 2023-02-20 19:28 ` Daniel Fleischer ` (2 subsequent siblings) 3 siblings, 1 reply; 11+ messages in thread From: Russell Adams @ 2023-02-20 19:20 UTC (permalink / raw) To: emacs-orgmode On Sat, Feb 18, 2023 at 04:22:33PM -0800, Alexis Gallagher wrote: > Hello, my fellow org-mode lovers, > > This is a feature request — or failing that, a request for advice on > a settings configuration which could produce this functionality now. Have you looked at org-attach-screenshot? https://github.com/dfeich/org-screenshot It uses org-attach and calls out to take a screenshot. I do the same with some local function's I wrote a while ago. It works very well for me. I run M-x my/org-screenshot, and after 3 seconds it will use Imagemagick's "import" command to allow me to select a region to screenshot and saves it to a filename I prepared. I do this daily, many times each day. > I wish org-mode had the ability to attach images to notes, display > them inline, and have that work well. By “work well” I mean a few > specific things: > > • the image is automatically resized to maintain aspect ratio and > • fit horizontally with a civilized margin, so that I can resize > • my emacs window without the image disappearing or swamping the > • other content. This is Emacs, not Org. Perhaps someone knows how to adjust that. > • you can still scroll the window one line height unit at a time, > • without the entire image being scrolled as if it were one giant > • line, breaking scrolling, as seems to happen on my emacs > • (version 28.x on Linux) Mine jumps too, but again that's Emacs, not Org. > • drag and drop, so I can add the image by dragging it in, for > • instance from a screenshot tool or from an image on a web page. I can't answer that. Drag and drop functions depend on your platform. Does anything else in Emacs use drag and drop? > • sensible defaults for storing the images bundled with notes and > • keeping the two associated, so that I don't subsequently live in > • fear of ever moving my org files I do save all of mine to the same directory as my org file in .org/Filename.org.screenshotYYYYMMDDHHMMSS.png. It means I can easily know what files below to my org document. > Why is this valuable, to me at least? I use org to take notes all > day, during meetings, on reading matter, in the development of my > own thoughts. Embedding images would let me collect every kind of > resource I can't reproduce by typing or copy and pasting text — > photos of slides during presentations, photos of whiteboard, key > snippets from websites, handwritten notes and equations, etc.. Of course it's valuable, and already implemented. I think you're asking more about refining how you use it. ------------------------------------------------------------------ Russell Adams RLAdams@AdamsInfoServ.com https://www.adamsinfoserv.com/ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: feature request: easy embedding of images 2023-02-20 19:20 ` Russell Adams @ 2023-02-20 21:24 ` Jude DaShiell 2023-02-21 12:21 ` Daniel Fleischer 0 siblings, 1 reply; 11+ messages in thread From: Jude DaShiell @ 2023-02-20 21:24 UTC (permalink / raw) To: Russell Adams, emacs-orgmode To help accessibility it would be useful when an image was dragged into org-mode if the user got prompted for an image description that gets associated with the image in org-mode. Some images are art work and those should get alt="" tags if a user fails to provide a description but only after asking if this image is art work or something that needs a description. If a description is provided that should go between the quotes in the alt="" tag. Jude <jdashiel at panix dot com> "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author, 1940) . On Mon, 20 Feb 2023, Russell Adams wrote: > On Sat, Feb 18, 2023 at 04:22:33PM -0800, Alexis Gallagher wrote: > > Hello, my fellow org-mode lovers, > > > > This is a feature request ? or failing that, a request for advice on > > a settings configuration which could produce this functionality now. > > Have you looked at org-attach-screenshot? > > https://github.com/dfeich/org-screenshot > > It uses org-attach and calls out to take a screenshot. > > I do the same with some local function's I wrote a while ago. It works > very well for me. I run M-x my/org-screenshot, and after 3 seconds it > will use Imagemagick's "import" command to allow me to select a region > to screenshot and saves it to a filename I prepared. > > I do this daily, many times each day. > > > I wish org-mode had the ability to attach images to notes, display > > them inline, and have that work well. By ?work well? I mean a few > > specific things: > > > > ? the image is automatically resized to maintain aspect ratio and > > ? fit horizontally with a civilized margin, so that I can resize > > ? my emacs window without the image disappearing or swamping the > > ? other content. > > This is Emacs, not Org. Perhaps someone knows how to adjust that. > > > ? you can still scroll the window one line height unit at a time, > > ? without the entire image being scrolled as if it were one giant > > ? line, breaking scrolling, as seems to happen on my emacs > > ? (version 28.x on Linux) > > Mine jumps too, but again that's Emacs, not Org. > > > ? drag and drop, so I can add the image by dragging it in, for > > ? instance from a screenshot tool or from an image on a web page. > > I can't answer that. Drag and drop functions depend on your > platform. Does anything else in Emacs use drag and drop? > > > ? sensible defaults for storing the images bundled with notes and > > ? keeping the two associated, so that I don't subsequently live in > > ? fear of ever moving my org files > > I do save all of mine to the same directory as my org file in > .org/Filename.org.screenshotYYYYMMDDHHMMSS.png. It means I can easily > know what files below to my org document. > > > Why is this valuable, to me at least? I use org to take notes all > > day, during meetings, on reading matter, in the development of my > > own thoughts. Embedding images would let me collect every kind of > > resource I can't reproduce by typing or copy and pasting text ? > > photos of slides during presentations, photos of whiteboard, key > > snippets from websites, handwritten notes and equations, etc.. > > Of course it's valuable, and already implemented. I think you're > asking more about refining how you use it. > > ------------------------------------------------------------------ > Russell Adams RLAdams@AdamsInfoServ.com > https://www.adamsinfoserv.com/ > > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: feature request: easy embedding of images 2023-02-20 21:24 ` Jude DaShiell @ 2023-02-21 12:21 ` Daniel Fleischer 0 siblings, 0 replies; 11+ messages in thread From: Daniel Fleischer @ 2023-02-21 12:21 UTC (permalink / raw) To: Jude DaShiell; +Cc: Russell Adams, emacs-orgmode Jude DaShiell [2023-02-20 Mon 16:24] wrote: > To help accessibility it would be useful when an image was dragged into > org-mode if the user got prompted for an image description that gets > associated with the image in org-mode. Some images are art work and those > should get alt="" tags if a user fails to provide a description but only > after asking if this image is art work or something that needs a > description. If a description is provided that should go between the > quotes in the alt="" tag. In org-download you can specify html attributes for the attached image, see link https://github.com/abo-abo/org-download/blob/master/org-download.el#L178-L184 It's not a prompt, it's a template and you can fill the alt description. -- Daniel Fleischer ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: feature request: easy embedding of images 2023-02-19 0:22 feature request: easy embedding of images Alexis Gallagher 2023-02-20 19:20 ` Russell Adams @ 2023-02-20 19:28 ` Daniel Fleischer 2023-03-23 14:34 ` [RFC] Limit inline image width by default (was: feature request: easy embedding of images) Ihor Radchenko 2023-03-24 12:49 ` feature request: easy embedding of images Ihor Radchenko 3 siblings, 0 replies; 11+ messages in thread From: Daniel Fleischer @ 2023-02-20 19:28 UTC (permalink / raw) To: Alexis Gallagher; +Cc: emacs-orgmode Alexis Gallagher [2023-02-18 Sat 16:22] wrote: > This is a feature request — or failing that, a request for advice on a settings configuration which could produce this > functionality now. Russell mentioned a package and pointed to the image issues related to Emacs, not Org. I want to suggest the package https://github.com/abo-abo/org-download which I use all time, for dragging and dropping images and for taking screeshots. -- Daniel Fleischer ^ permalink raw reply [flat|nested] 11+ messages in thread
* [RFC] Limit inline image width by default (was: feature request: easy embedding of images) 2023-02-19 0:22 feature request: easy embedding of images Alexis Gallagher 2023-02-20 19:20 ` Russell Adams 2023-02-20 19:28 ` Daniel Fleischer @ 2023-03-23 14:34 ` Ihor Radchenko 2023-03-23 14:57 ` Ruijie Yu via General discussions about Org-mode. ` (3 more replies) 2023-03-24 12:49 ` feature request: easy embedding of images Ihor Radchenko 3 siblings, 4 replies; 11+ messages in thread From: Ihor Radchenko @ 2023-03-23 14:34 UTC (permalink / raw) To: Alexis Gallagher; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 459 bytes --] Alexis Gallagher <alexisgallagher@gmail.com> writes: > • the image is automatically resized to maintain aspect ratio and fit horizontally with a civilized margin, so that I can resize my emacs window without the image disappearing or swamping the other content. We cannot automatically resize images in Elisp. At least, I know no good way to do it reliably. But we can try to improve the defaults for wide images. See the tentative patch. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-lisp-org.el-Allow-limiting-inline-image-width.patch --] [-- Type: text/x-patch, Size: 5745 bytes --] From 180e322c2c79ea88d87f908299a5c0e69c47a7b2 Mon Sep 17 00:00:00 2001 Message-Id: <180e322c2c79ea88d87f908299a5c0e69c47a7b2.1679581960.git.yantar92@posteo.net> From: Ihor Radchenko <yantar92@posteo.net> Date: Thu, 23 Mar 2023 15:31:33 +0100 Subject: [PATCH] lisp/org.el: Allow limiting inline image width * lisp/org.el (org-image-max-width): New custom variable controlling max inline image width. (org--create-inline-image): Use the new variable. * doc/org-manual.org (Images): * etc/ORG-NEWS (New customization ~org-image-max-width~ limiting the displayed inline image width): Document the new variable. --- doc/org-manual.org | 20 +++++++++++++++++--- etc/ORG-NEWS | 15 +++++++++++++++ lisp/org.el | 29 ++++++++++++++++++++++++++++- 3 files changed, 60 insertions(+), 4 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index 37fd3df14..3d729bdf6 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -11495,14 +11495,19 @@ ** Images #+vindex: org-image-actual-width + #+vindex: org-image-max-width #+cindex: @samp{ORG-IMAGE-ACTUAL-WIDTH}, property By default, Org mode displays inline images according to their - actual width. You can customize the displayed image width using + actual width, but no wider than ~fill-column~ characters. + + You can customize the displayed image width using ~org-image-actual-width~ variable (globally) or =ORG-IMAGE-ACTUAL-WIDTH= property (subtree-level)[fn:: The width can be customized in Emacs >= 24.1, built with imagemagick support.]. Their value can be the following: - (default) Non-nil, use the actual width of images when inlining them. + It the actual width is too wide, limit it according to + ~org-image-max-width~. - When set to a number, use imagemagick (when available) to set the image's width to this value. - When set to a number in a list, try to get the width from any @@ -11512,8 +11517,17 @@ ** Images #+end_example and fall back on that number if none is found. - When set to nil, try to get the width from an =#+ATTR.*= keyword - and fall back on the original width if none is found. - + and fall back on the original width or ~org-image-max-width~ if + none is found. + + ~org-image-max-width~ limits the maximum displayed image width, but + only when the image width is not set explicitly. Possible maximum + width can be set to: + - (default) ~fill-column~, limit width to ~fill-column~ number of + characters. + - ~window~, limit width to current window width. + - integer number, limit width that specified number of pixels. + - nil, do not limit the width. #+vindex: org-cycle-inline-images-display Inline images can also be displayed when cycling the folding state. diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 4d45e6507..2611cc570 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -24,6 +24,21 @@ consider [[https://gitlab.com/jackkamm/ob-python-mode-mode][ob-python-mode-mode] has been ported to. ** New and changed options +*** New customization ~org-image-max-width~ limiting the displayed inline image width + +New custom variable ~org-image-max-width~ limits the maximum inline +image width, but only when the inline image width is not explicitly +set via ~org-image-actual-width~, =ORG-IMAGE-ACTUAL-WIDTH= property, +or =#+ATTR*= keyword. + +By default, when ~org-image-actual-width~ is set to t, +~org-image-max-width~ takes effect. Its default value is set to +~fill-column~, limiting the image previews to ~fill-column~ number of +characters. + +To fall back to previous defaults, where the inline image width is not +constrained, set ~org-image-max-width~ to nil. + *** New ~org-cite-natbib-export-bibliography~ option defining fallback bibliography style ~natbib~ citation export processor now uses diff --git a/lisp/org.el b/lisp/org.el index 20e6ea6d9..43d659536 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -15096,6 +15096,24 @@ (defcustom org-image-actual-width t (list :tag "Use #+ATTR* or a number of pixels" (integer)) (const :tag "Use #+ATTR* or don't resize" nil))) +(defcustom org-image-max-width 'fill-column + "When non-nil, limit the displayed image width. +This setting only takes effect when `org-image-actual-width' is set to +t or when #+ATTR* is set to t. + +Possible values: +- `fill-column' :: limit width to `fill-column' +- `window' :: limit width to window width +- number :: limit width to number in pixels +- nil :: do not limit image width" + :group 'org-appearance + :package-version '(Org . "9.7") + :type '(choice + (const :tag "Do not limit image width" nil) + (const :tag "Limit to `fill-column'" fill-column) + (const :tag "Limit to window width" window) + (integer :tag "Limit to a number of pixels"))) + (defcustom org-agenda-inhibit-startup nil "Inhibit startup when preparing agenda buffers. When this variable is t, the initialization of the Org agenda @@ -16229,7 +16247,16 @@ (defun org--create-inline-image (file width) width 'imagemagick) remote? - :width width :scale 1)))) + :width width + :max-width + (pcase org-image-max-width + (`fill-column (pixel-fill-width fill-column)) + (`window (window-width nil t)) + ((pred integerp) org-image-max-width) + (`nil nil) + (_ (error "Unsupported value of `org-image-max-width': %S" + org-image-max-width))) + :scale 1)))) (defun org-display-inline-images (&optional include-linked refresh beg end) "Display inline images. -- 2.39.1 [-- Attachment #3: Type: text/plain, Size: 224 bytes --] -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92> ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [RFC] Limit inline image width by default (was: feature request: easy embedding of images) 2023-03-23 14:34 ` [RFC] Limit inline image width by default (was: feature request: easy embedding of images) Ihor Radchenko @ 2023-03-23 14:57 ` Ruijie Yu via General discussions about Org-mode. 2023-03-23 15:25 ` Christopher M. Miles ` (2 subsequent siblings) 3 siblings, 0 replies; 11+ messages in thread From: Ruijie Yu via General discussions about Org-mode. @ 2023-03-23 14:57 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Alexis Gallagher, emacs-orgmode Small nit, in case you are about to install it. > + It the actual width is too wide, limit it according to > + ~org-image-max-width~. "It" -> "If". -- Best, RY ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC] Limit inline image width by default (was: feature request: easy embedding of images) 2023-03-23 14:34 ` [RFC] Limit inline image width by default (was: feature request: easy embedding of images) Ihor Radchenko 2023-03-23 14:57 ` Ruijie Yu via General discussions about Org-mode. @ 2023-03-23 15:25 ` Christopher M. Miles 2023-04-05 12:48 ` Rudolf Adamkovič 2023-04-09 9:00 ` Ihor Radchenko 3 siblings, 0 replies; 11+ messages in thread From: Christopher M. Miles @ 2023-03-23 15:25 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Alexis Gallagher, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 348 bytes --] This is an acceptable solution for large width image. I propose this RFC too. -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC] Limit inline image width by default (was: feature request: easy embedding of images) 2023-03-23 14:34 ` [RFC] Limit inline image width by default (was: feature request: easy embedding of images) Ihor Radchenko 2023-03-23 14:57 ` Ruijie Yu via General discussions about Org-mode. 2023-03-23 15:25 ` Christopher M. Miles @ 2023-04-05 12:48 ` Rudolf Adamkovič 2023-04-09 9:00 ` Ihor Radchenko 3 siblings, 0 replies; 11+ messages in thread From: Rudolf Adamkovič @ 2023-04-05 12:48 UTC (permalink / raw) To: Ihor Radchenko, Alexis Gallagher; +Cc: emacs-orgmode Ihor Radchenko <yantar92@posteo.net> writes: > See the tentative patch. This looks fantastic! +1 for using the Fill Column by default. Rudy -- "The introduction of suitable abstractions is our only mental aid to organize and master complexity." -- Edsger Wybe Dijkstra, 1930-2002 Rudolf Adamkovič <salutis@me.com> [he/him] Studenohorská 25 84103 Bratislava Slovakia ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC] Limit inline image width by default (was: feature request: easy embedding of images) 2023-03-23 14:34 ` [RFC] Limit inline image width by default (was: feature request: easy embedding of images) Ihor Radchenko ` (2 preceding siblings ...) 2023-04-05 12:48 ` Rudolf Adamkovič @ 2023-04-09 9:00 ` Ihor Radchenko 3 siblings, 0 replies; 11+ messages in thread From: Ihor Radchenko @ 2023-04-09 9:00 UTC (permalink / raw) To: Alexis Gallagher; +Cc: emacs-orgmode Ihor Radchenko <yantar92@posteo.net> writes: > But we can try to improve the defaults for wide images. > > See the tentative patch. > > From 180e322c2c79ea88d87f908299a5c0e69c47a7b2 Mon Sep 17 00:00:00 2001 > Message-Id: <180e322c2c79ea88d87f908299a5c0e69c47a7b2.1679581960.git.yantar92@posteo.net> > From: Ihor Radchenko <yantar92@posteo.net> > Date: Thu, 23 Mar 2023 15:31:33 +0100 > Subject: [PATCH] lisp/org.el: Allow limiting inline image width Applied, onto main. Fixing the spotted typo and replacing `pixel-fill-width' with `frame-char-width' that is available in Emacs 26. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=ddd8281e6 -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: feature request: easy embedding of images 2023-02-19 0:22 feature request: easy embedding of images Alexis Gallagher ` (2 preceding siblings ...) 2023-03-23 14:34 ` [RFC] Limit inline image width by default (was: feature request: easy embedding of images) Ihor Radchenko @ 2023-03-24 12:49 ` Ihor Radchenko 3 siblings, 0 replies; 11+ messages in thread From: Ihor Radchenko @ 2023-03-24 12:49 UTC (permalink / raw) To: Alexis Gallagher; +Cc: emacs-orgmode Alexis Gallagher <alexisgallagher@gmail.com> writes: > • you can still scroll the window one line height unit at a time, without the entire image being scrolled as if it were one giant line, breaking scrolling, as seems to happen on my emacs (version 28.x on Linux) Emacs will actually scroll partially when the image is taller than window height. But not otherwise. Changing this is not trivial. See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62048#17 -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92> ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-04-09 8:58 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-02-19 0:22 feature request: easy embedding of images Alexis Gallagher 2023-02-20 19:20 ` Russell Adams 2023-02-20 21:24 ` Jude DaShiell 2023-02-21 12:21 ` Daniel Fleischer 2023-02-20 19:28 ` Daniel Fleischer 2023-03-23 14:34 ` [RFC] Limit inline image width by default (was: feature request: easy embedding of images) Ihor Radchenko 2023-03-23 14:57 ` Ruijie Yu via General discussions about Org-mode. 2023-03-23 15:25 ` Christopher M. Miles 2023-04-05 12:48 ` Rudolf Adamkovič 2023-04-09 9:00 ` Ihor Radchenko 2023-03-24 12:49 ` feature request: easy embedding of images Ihor Radchenko
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.