Maybe quite a noob question, but I can't figure out how to display inline eps images in an org file. There is no problem with png (or jpeg, ...) images, but I can't preview eps images.

Here is a minimal example with an R code block that produces a .eps file:

#+TITLE: Images eps

#+begin_src R :results silent :exports none :session *R*
plot(iris[, 1:2])


This MWE can be correctly exported as a PDF file, but image.eps cannot be displayed inside the org file.

I have ImageMagick installed, and I have the following instructions in my init file (edited after NickD's answer):

(setq imagemagick-enabled-types t)
(add-to-list 'image-file-name-extensions "eps")
(setq org-image-actual-width 400)

Here is what I get with those settings, although the file image.eps does exist, and is correctly inserted in the PDF/LaTeX export: enter image description here

I guess the solution is some additional tweaking related to ImageMagick.

It seems that a similar (old!) question on StackExchange is also unanswered: Org-mode inline .eps images display error. (.eps created by AI ok, .eps created by matplotlib no)


1 Answer 1


There are various things that can go wrong:

  • does your emacs support ImageMagick?

Evaluate (image-type-available-p 'imagemagick); if that returns t, this check passes. If not, you'll have to rebuild your emacs, possibly after installing the ImageMagick development libraries. The configure flag is --with-imagemagick.

  • did you call imagemagick-register-types after setting imagemagick-enabled-types?

It's probably OK if you set it in your init file and have restarted emacs, but you might as well make sure. I did

(setq imagemagick-enabled-types t)
  • (probably unnecessary) is eps an acceptable image file extension?

Evaluate the variable image-file-name-extensions to find out. This might be unnecessary, but I did (add-to-list 'image-file-name-extensions "eps") just to make sure.

  • (very important) What is the value of org-image-actual-width?

If it is t, then org-display-inline-images sets the width to nil (i.e. use the actual width of the image) before calling org--create-inline-image which bypasses ImageMagick and lets the create-image code do as it wishes: that might work if you don't use the Cairo libraries in your emacs, but not otherwise: the code in image.c disables Ghostscript if Cairo is enabled. So it seems that the Org mode handling of images at their actual size is broken ATM.

Fortunately for you, you want to set the width explicitly, so all you have to do is set org-image-actual-width to nil. That allows ImageMagick to be used and all is well:

(setq org-image-actual-width nil)

I can then do C-c C-x C-v and get inline display of .eps (with a size spec), .png (natural size), .jpg (natural size) and .pdf (with a size spec) - but for this last I had to add pdf to image-file-name-extensions (maybe I'm doing something wrong, but no more time to investigate).

EDIT: Here are some additional points that might be helpful:

  • Did you check that imagemagick is available in your emacs? Do M-: (image-type-available-p 'imagemagick) - does it return t?

  • I tried it with (setq org-image-actual-width 400) and it works for me.

  • Maybe post the versions of emacs and Org mode that you are using - things might be version dependent.

  • When you do display <image-file-name> from the command line, do you see your image?

Finally, you might want to investigate Edebug which is what I've been using in this investigation. Find the definition of the function org--create-inline-image in org.el, do C-u C-M-x with the point somewhere inside the definition (you should see the message Edebug: org--create-inline-image in the echo area) and then try to display inline images again with C-c C-x C-v (if they are toggled on, you'll have to toggle them off and then back on again, so C-c C-x C-v twice). Code execution should stop when the above function is entered: press <Space> repeatedly to step through the function (note that the result of each evaluation is printed in the echo area) until you get to the call to create-image and then carefully step through the argument evaluation in that call and write down what the various arguments evaluate to and what the result of the function call is. In my case, I get

  • file-or-data: /tmp/image.eps
  • image-type: imagemagick
  • remote?: nil
  • props: :width 400

and create-image returns (image :type imagemagick :file /tmp/image.eps" :scale 1 :width 400).

If you want, post what you get in your case: it will at the very least decide the question "Is it Org mode or is it image.el that's not working properly?".

To restore the instrumented function to its former non-instrumented state, you can do C-M-x in the function, or M-x load-library RET org RET or M-x org-reload or restart emacs. The last one is the safest.

  • Many thanks! I think I'm close to the answer... but it still not works. There were two problems: 1/ (add-to-list 'image-file-name-extensions "eps") was indeed necessary, I added that line in my init file. 2/ org-image-actual-width was set to t. I've tried with (setq org-image-actual-width nil) or with a fixed value such as (setq org-image-actual-width 400), and both of them are still unsuccessful. I've updated my initial post accordingly. So I suspect there is yet another problem...
    – Philopolis
    Apr 24, 2020 at 8:03
  • 1
    Thanks! With your help, the problem is finally identified. display image.eps from the command line produces an error: display: attempt to perform an operation not allowed by the security policy 'gs'. This is something ArchLinux has decided: bugs.archlinux.org/task/60580. So, this is bascially a security policy from my distro, and not a bug. I should be able to fix that on my own. Thanks again!
    – Philopolis
    Apr 26, 2020 at 16:52
  • Excellent! Thanks for the update.
    – NickD
    Apr 26, 2020 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.