22

I can see many image formats in orgmode, but not SVG.

I get the error Invalid image type 'svg' when I run org-display-inline-images.

It should be possible given this question exists: https://www.reddit.com/r/emacs/comments/2o21gf/orgmode_svg_rendering/

I didn't see an obvious package to install, or other way to fix this.

EDIT: This is on Mac OS X 10.9.5, Emacs 24.4.1 (installed via homebrew), Org 8.3.2. (image-type-available-p 'svg) returns nil.

avv
  • 1,563
  • 10
  • 24
  • 7
    Emacs handles this differently depending upon the OS, and depending upon the libraries available at the time of building Emacs and the libraries available subsequent to building Emacs. What OS and what version of Emacs are you using, and where did you download the Emacs version if you did not build it from scratch? Evaluate in a `*Scratch*` buffer `(image-type-available-p 'svg)` or just type `M-x eval-expression RET (image-type-available-p 'svg) RET` and see whether the answer is `t`? If the answer is `nil`, then you don't have `svg` support presently available -- i.e., time for plan B. – lawlist Oct 21 '15 at 01:59
  • This is on Mac OS X 10.9.5, Emacs 24.4.1 (I believe via homebrew), Org 8.3.2. Sadly, that function call returns `nil`. – avv Oct 21 '15 at 07:32
  • 3
    If by homebrew, I think you must have compiled it yourself? The solution might be as simple as installing libsvg (presumably also available in homebrew) and then recompiling emacs. The configure script should take care of the rest. – Harald Hanche-Olsen Oct 21 '15 at 12:48
  • 2
    Great! I used `which emacs` and `brew info emacs` to confirm that I installed via homebrew, and it was missing `librsvg`, so I used brew to install `librsvg`. That said, I'm a little worried about re-compiling emacs right now, given deadlines and the potential for that to take longer than expected when something else breaks. But I'll try that soon, especially if I can figure out a way to make sure I can easily return to the old setup if need be (is it just a matter of backing up the emacs binary? or might homebrew change/update a number of binaries and other files?). – avv Oct 21 '15 at 17:52
  • Since I don't use homebrew myself, I can't comment on how hard it is to back out of a failed upgrade. But if you have built the nextstep version, getting `Emacs.app`, everything should be contained in that, so you just take a copy and put it somewhere safe. If you built the X11 version, there will be lots of files created as part of the installation. – Harald Hanche-Olsen Oct 21 '15 at 18:03
  • Is there any other way to add svg support to emacs or finding a version that already supports it? I'm running into the same problem, but have zero experience with compiling it myself. Thanks for helping! – Guilherme Salomé Jul 09 '17 at 02:29
  • 3
    Is this still a problem? Maybe the OP can post a progress report as an answer. FWIW, I tried it with current upstream emacs (GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.13) of 2020-04-23) and current org mode (Org mode version 9.3.6 (release_9.3.6-506-gdcb562 @ /home/nick/elisp/org-mode/lisp/)), built with librsvg-2.0 on Fedora 31, and svg works fine. – NickD Apr 25 '20 at 18:53
  • 4
    Still a problem with Emacs 27.2 on macOS, but the issue is just that the version of emacs installed from `brew` isn't compiled with SVG support, which can be confirmed by looking at the `system-configuration-features` variable. The binary comes from https://emacsformacosx.com/, and there is an open issue to add SVG support to those builds: https://github.com/caldwell/build-emacs/issues/37 – gsgx Mar 10 '22 at 08:39

1 Answers1

1

Since there is still some activity here:

Take a look on this github project that has a couple of excellent builds of emacs for MacOS: https://github.com/jimeh/emacs-builds

I currently use emacs-app-good cask and I am happy with it. SVG support is included of course.

Khoulaiz
  • 31
  • 2