In org mode, I am trying to resize inline images to fit a 100px x 100px square, which would be particular useful in the cases in which an image is much taller that wider, or vice versa. In other words I would like the resized image to be contained in 100px x 100px square, and to be with at least one side of 100px.

I am using the following code:

#+STARTUP: showall
#+STARTUP: inlineimages

* section 1
  - my org file

;; Local Variables:
;; eval: (setq org-image-actual-width 100)
;; eval: (setq org-image-actual-height 100)
;; eval: (org-display-inline-images t t)
;; End:

But it does not work, in the sense that the width is set to 100px, but the height is not taken into account. How can I obtain the behavior I am seeking?

  • 1
    There is no variable called org-image-actual-height in Org mode: you create one, but Org mode does not pay any attention to it, because the code does not reference it at all. The point is that you cannot set both, because that would change the aspect ration and distort the image. So Org mode allows you to set one: the width; the height is then scaled by the same factor. But there is no way to set the height and let the width scale. You'd need to modify the function org-display-inline-images (I think) to do what you want. – NickD Feb 8 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.