Here is a way to resize images in emacs Org mode for preview (not exporting). Typically,
- We want to set an image to a specific width like 249px when we need to.
- We want to set a default image width, so that we don't need to specify
+attr_html
for every image - that would be tedious.
This can be achieved by configuring org-image-actual-width
like follows:
(setq org-image-actual-width (list 550))
Then, in your .org
file, if you have
#+attr_html :width 249
[[~/images/example1.jpg]]
then the image will be displayed in preview at width 249px. For another image, where no +attr_*
is specified, the default width of 550px will be applied.
[[~/images/example2.jpg]]
You can see this behavior from the documentation in org-mode source code:
When set to a number in a list, try to get the width from any
#+ATTR.* keyword if it matches a width specification like
#+ATTR_HTML: :width 300px
and fall back on that number if none is found.
I found it hard to understand what does "a number in a list mean", so I looked at the implementation, and indeed, something like (list 550)
works.