Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

ImageMagick: JPEG-PDF Conversion Segmentation Fault

📅 2010-Apr-12 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

As I have blogged earlier, I use the ImageMagick convert program to convert my JPG scans to PDF files. This command which works fine on Windows ends up in a segmentation fault on Ubuntu:

$ convert scans-*.jpeg fooBar.pdf
Segmentation fault

There is a workaround for this error by using a compression method that is different (JPEG) from the default method (Zip). But, the real longterm solution seems to be a switch to GraphicsMagick.


What is this GraphicsMagick you say? It is a fork of the ImageMagick code aimed at efficiency, performance and stability. It pains me to see projects in the opensource world forking like this even today. GraphicsMagick is available on Ubuntu repositories and can be installed using the Synaptic Package Manager by looking for the graphicsmagick package. Using GraphicsMagick for the JPEG-PDF conversion worked fine without any errors. GraphicsMagick commands and parameters are the same as ImageMagick, except with a prefix of gm:

$ gm convert scans-*.jpeg fooBar.pdf