Lyx, Error Converting to Loadable Format for PDFs

Short answer: https://wiki.lyx.org/LyX/FiguresInLyX

Long answer:

To view a image on the LyX screen, it is required a compatible format with that XForms or Qt GUI libraries, namely bmp, gif, jpeg, pbm, pgm, ppm, tif, xbm or mng, png and xpm, respectively.

A message "Error converting to loadable format" mean that is not possible convert the image to PNG or any of these formats.

then you'll need to augment the list of known converters.

The link shows a detailed example of adding a converter. Pay attention that the converters are in the right path.

However,

If you see the "Error converting to loadable format" message only with PDF files and you've verified that you have the converter tools mentioned above, check which version of GhostScript you are using.

Version 8.7 of GhostScript has a known bug that prevents LyX from loading PDFs. Use the newest version. (The link above also explain a manual fix).


I'm using Lyx 2.2 under macOS Sierra. In my case, the problem was the ImageMagick version (7), and its incompatibility issues with LyX conversion scripts, as mentioned here: https://www.mail-archive.com/[email protected]/msg194142.html.

I'm using brew, so I fixed this problem by removing imagemagic and installing the latest 6.x version: imagemagick@6 and then creating a symbolic link (in /usr/local/bin) pointing to /usr/local/Cellar/imagemagick\@6/6.9.7-5/bin/convert .

brew uninstall imagemagick
brew install imagemagick@6
ln -s /usr/local/Cellar/imagemagick\@6/6.9.7-9/bin/convert /usr/local/bin/convert

Hope it helps


Ok rather than fiddling around with ImageMagick and Ghostscript, we can rely on sips which is built in to OSX. It's what the official fix does.

  1. Go to Lyx->Preferences->File Handling->Converters.
  2. Change the From format: to PDF (graphics), the To format: to PNG and paste this in the Converter: box: sips --resampleWidth 800 --setProperty format png $$i --out $$o.
  3. Click Add. Yes this dialog is weird - you don't add an entry then configure it, you change the options and then click Add. Confusing.
  4. Click Save. DO NOT CLICK APPLY! For some reason it shows an empty window and crashes Lyx.

The resulting PDFs can be a bit low res. You can increase the 800 if you like.

This fix should already be in Lyx 2.2.4 or later I think.