Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a two-page PDF file that I would like to convert to an animated GIF file. A post on the TeX StackExchange gives the following ImageMagick one-liner:

convert -verbose -delay 50 -loop 0 -density 300 file.pdf file.gif

If I try this on a linux box (convert --version gives 6.5.4-7 2012-04-10) I get this log:

"gs" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=0 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r300x300"  "-sOutputFile=/tmp/magick-XX30a4nG" "-f/tmp/magick-XX690OkA" "-f/tmp/magick-XX3GCKhu"
/tmp/magick-XX30a4nG[0] PNM 1512x1134 1512x1134+0+0 8-bit DirectClass 9.811mb
/tmp/magick-XX30a4nG[1] PNM 1512x1134 1512x1134+0+0 8-bit DirectClass 9.811mb
file.pdf[0] PDF 1512x1134 1512x1134+0+0 16-bit DirectClass 9.811mb
file.pdf[0] PDF 1512x1134 1512x1134+0+0 16-bit DirectClass 9.811mb
file.pdf=>file-linux.gif[0] PDF 1512x1134 1512x1134+0+0 16-bit Palette PseudoClass 111c 2.620u 0:03

[gs is GPL Ghostscript 8.70 (2009-07-31)] and it works as expected. But if I try this on my mac, using the ImageMagick suite installed by macports (6.8.0-7 2013-01-04), I get this log:

"/opt/local/bin/gsx" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r300x300"  "-sOutputFile=/var/folders/kf/t7750q1w8xjcjy0059bpyx180000gq/T/magick-15750GLLaATgky5I1" "-f/var/folders/kf/t7750q1w8xjcjy0059bpyx180000gq/T/magick-15750ljasKifrwJcW" "-f/var/folders/kf/t7750q1w8xjcjy0059bpyx180000gq/T/magick-15750w8mj9AZrkJA8"
/var/folders/kf/t7750q1w8xjcjy0059bpyx180000gq/T/magick-15750GLLaATgky5I1 PNG 1512x1134 1512x1134+0+0 8-bit sRGB 64.5KB 0.050u 0:00.049
file.pdf PDF 1512x1134 1512x1134+0+0 16-bit sRGB 64.5KB 0.000u 0:00.000
file.pdf=>file.gif PDF 1512x1134 1512x1134+0+0 16-bit Palette sRGB 106c 0.410u 0:00.409

[/opt/local/bin/gsx is GPL GhostScript 9.06 (2012-08-08)] This time the resulting GIF file has only one frame, the first page of the PDF.

My workaround so far has been to use pdftk file.pdf burst to split out each page of the PDF to its own file, then convert [options] pg_*.pdf file.gif. This works fine, but I'd prefer a one-line script.

The mac versions being more recent, I would guess it's a matter of implementation. The only major difference I see between the two is -sDEVICE=pnmraw for the linux version and -sDEVICE=pngalpha for the mac. Can I tell convert to pass options to gsx?

share|improve this question
YES ? :), but to be honest, why dont you just try it! – user44516 Mar 20 '13 at 13:51
@Borderline: I tried adding -sDEVICE=pnmraw to the convert command line options and got an "unrecognized option" response. – Matthew Leingang Mar 20 '13 at 14:16
Why not combine both commands into a single line command? pdftk file.pdf burst && convert [options pg_*.pdf file.gif This way, Terminal will run the second command once it has completed the first command you requested. – Danijel-James W Oct 3 '13 at 0:05

The following command worked well for me from a paper PDF I've worked on. The only difference from your original command is deactivating the alpha channel:

convert -alpha deactivate -verbose -delay 50 -loop 0 -density 300 paper.pdf file.gif

I'm using Version: ImageMagick 6.8.3-3 2013-02-21 Q16 and homebrew.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.