Imagemagick, Snow Leopard and PDF Conversion

2

1

Having difficulties with Imagemagick and Snow Leopard.

Imagemagick was installed using the install script from here here. Everything builds and installs correctly. Imagemagick behave normally for all commands (that I can find) except when trying to convert a PDF. For example,

$ convert my.pdf my.jpg
Segmetation Fault

I thought it may be ghostscript and tried to run the command that Imagegick delegates too (via the -verbose option)

$ convert -verbose spec/fixtures/documents/upload_test_file.pdf test.jpg
"gs" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=0 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72"  "-sOutputFile=/var/folders/Xz/Xz6TDr0DFQaV5J1F7Ndamk+++TM/-Tmp-/magick-4zvJXfSz" "-f/var/folders/Xz/Xz6TDr0DFQaV5J1F7Ndamk+++TM/-Tmp-/magick-O7a9fDyp" "-f/var/folders/Xz/Xz6TDr0DFQaV5J1F7Ndamk+++TM/-Tmp-/magick-rBEzLUsx"
Segmentation fault
$ "gs" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=0 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72"  "-sOutputFile=my.jpg" "-fmy.pdf"

And it works. It creates the pnmrow file as its supposed to.

I am not sure where to go from here, anyone else seen this or seen it and solved it?

EDIT:

As Kasper Souren answered below, I have since switched to Homebrew to manage these libraries.

Peer Allan

Posted 2009-09-04T20:54:54.693

Reputation: 123

try converting to pdf from other formats e.g tiff, png, etc. does it work? – caliban – 2009-09-04T21:00:14.137

Answers

0

Looks like the imagemagick team is aware of the problem and it was fixed in version 6.5.5-8.

The MacPorts package uses the newer version of ImageMagick as of 9/16/09. Try doing a self update and then upgrading php5-imagick.

sudo port selfupdate
sudo port upgrade php5-imagick

This fixed the problem for me.

Devon

Posted 2009-09-04T20:54:54.693

Reputation: 116

I am intentionally avoiding Macports. Downloading and building from source ImageMagick-6.5.6-1 solved the problem also. Or you can use the handy install script here http://github.com/maddox/magick-installer

– Peer Allan – 2009-09-18T12:46:07.340

0

A segmentation fault is an error with the memory handling in the program, so it would be either a bug in the build processes or in the program itself. I installed ImageMagick using MacPorts rather than building from the source on their side and the MacPorts version of ImageMagick also seems to be bugged because of ghostscript. If you open the file in Preview, the Save As... JPEG should work fine.

EDIT:

I messed around with this some more and have something that works using ghostscript:

gs -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT \
  -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=0 \
  "-sDEVICE=jpeg" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 \
  "-r72x72" "-sOutputFile=out.jpeg" in.pdf

Where out.jpeg is the output file and in.pdf at the end is your input file.

You can also change -r72x72 to some other resolution if you want to tweak the output resolution higher than 72 dpi.

Lara Dougan

Posted 2009-09-04T20:54:54.693

Reputation: 2 266

Unfortunately, we need to do this programmatically. I am wondering if it isn't something to do with 64-bit. Before updating to Snow Leopard there were no problems at all – Peer Allan – 2009-09-05T00:38:12.943

It doesn't appear to be anything with 64-bitness as it also fails on my 32-bit only MacBook. – Lara Dougan – 2009-09-05T02:05:17.387

i regards you your edit, Adam. We discovered that at about the same time you did and are having success with it. So far no luck in finding a solution so it will work how we need programmatically, but this does solve the initial problem. – Peer Allan – 2009-09-08T19:59:02.180

An alternative source for ImageMagick is macports. http://www.macports.org/

– orj – 2009-09-11T12:58:24.047

0

I suggest moving to Homebrew, a more modern variant of macports and fink.

brew install imagemagick

kqw

Posted 2009-09-04T20:54:54.693

Reputation: 1 781

Agreed, this is how I have it installed now. Of course, when this question was asked it didn't exist yet. – Peer Allan – 2013-06-05T12:07:57.993