How to resize images in org-mode

别来无恙 提交于 2019-12-02 15:47:53
yPhil

As of Org 8.0, "Attribute lines now take plists" :

#+attr_html: :width 100px
#+attr_latex: :width 100px
[[~/images/example.jpg]]

As per Jacobo's comment, add the following to your init.el file:

(setq org-image-actual-width nil)

Then in org-mode, you can use this for inline previews of JPGs and PNGs. Doesn't appear to work for SVGs (no idea why)

#+ATTR_ORG: :width 100
[[~/images/example.jpg]]

and if you want to size this for both inline previews and html output:

#+ATTR_HTML: width="100px"
#+ATTR_ORG: :width 100
[[~/images/example.jpg]]
#+ATTR_HTML: width="100px"
[[~/images/example.jpg]]
Alioth

This is a sample on how to resize an image using percentages (Org mode version 9.0.5):

#+CAPTION: Weight space                                                                                                                                     
#+ATTR_HTML: :alt neural network :title Neural network representation :align right                                                                          
#+ATTR_HTML: :width 50% :height 50%                                                                                                                         
https://i.stack.imgur.com/nzHSl.jpg

For LaTeX, to remove the default width=.9\linewidth, set the org-latex-image-default-width to empty string. By this way, the image will have its natural size.

To do that on the fly use the set-variable emacs command. Or to set this variable permanently, add the following line in your init.el : (setq org-latex-image-default-width "")

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!