Reputation: 651
How can I display inline images in emacs org mode?
I have [[file:~/myimage.png]]
, which, when clicked, opens the image in a new buffer.
But how to do it in the same buffer?
Note: C c C x C v is undefined, so I couldn't activate the inline images, but how do I solve this problem?
Upvotes: 36
Views: 35777
Reputation: 10290
One solution that I found online somewhere that proved very useful for me (to get org-mode to re-display images when I edited and re-eveluated a graphviz src block, for example), was to evaluate the following (or put it in your init file):
(add-hook 'org-babel-after-execute-hook 'org-redisplay-inline-images)
I then find myself able to run C-c C-c from anywhere in the source block, and the code is re-executed, with the resulting image automatically displayed. This combined with either:
(setq org-display-inline-images t)
or, within a particular buffer:
#+STARTUP: inlineimages
... should allow you to just always see your images within org-mode, including upon re-computation of an image generated as a result of executing a code block.
Upvotes: 1
Reputation: 1064
you need not define a custom function like @abo-abo , org-mode has provide such functions :
M-x
- org-redisplay-inline-images
- org-display-inline-images
- org-toggle-inline-images
- org-remove-inline-images
M-x org-toggle-inline-images is quite enough for me , which toggle display/hiden inline images
Upvotes: 79
Reputation: 20352
This works for me:
(defun do-org-show-all-inline-images ()
(interactive)
(org-display-inline-images t t))
(global-set-key (kbd "C-c C-x C v")
'do-org-show-all-inline-images)
And here's how I found how to do it:
org.*image.*
.org-display-inline-images
.(org-display-inline-images t t)
.defun
/global-set-key
.Upvotes: 30