问题
Is there a general way to define the size, in percent or pixels, for an image that is linked in org-mode
?
Say I have the following link in my .org
file:
[[~/images/example.jpg]]
This JPG is way too large, so if I export it to HTML or LaTeX or open it in org-mode
with C-c C-o i will only see a fraction of the image.
回答1:
As of Org 8.0, "Attribute lines now take plists" :
#+attr_html: :width 100px
#+attr_latex: :width 100px
[[~/images/example.jpg]]
回答2:
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]]
回答3:
#+ATTR_HTML: width="100px"
[[~/images/example.jpg]]
回答4:
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
回答5:
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 "")
来源:https://stackoverflow.com/questions/11670654/how-to-resize-images-in-org-mode