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)
(imagemagick-register-types)
- (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.