Discussion:
ImageMagick hangs on Windows when converting large PDF to PNG
Ryan Kelly
2010-05-21 12:34:23 UTC
Permalink
Hi,

I am trying to use ImageMagick to convert a large number of PDFs to PNGs on
Windows (XP). When attempting to convert one particularly large PDF (note
large dimension-wise, not file-size-wise), ImageMagick seems to hang. I can
see in the process list in task manager, convert.exe, is taking large
amounts of CPU time/memory initially, then "slowing down" and using less
memory/CPU, but never exiting, and causing the computer itself to run
extremely slow. I then kill the process, which also leaves what appear to be
temporary files in "C:\", some larger than 500MB. This problem doesn't seem
to exist on Linux, as I have the same version of ImageMagick installed on
one of my Ubuntu boxes, and it performs the conversion in a timely manner. I
am fully aware that ImageMagick is using ghostscript to convert the PDF, but
I don't see it in the process list, and I am also unsure as to how
ImageMagick interacts with ghostscript to perform the conversion. I am using
ImageMagick version 6.6.1-7 with ghostscript version 8.71, with command line
flags `-density 150 and -resize 2000`. Ghostscript is the same version on my
Linux machine as well. This is the pdf in question:
http://24.187.210.198/other/big.pdf

Thanks,
-Ryan Kelly
d***@imagemagick.org
2010-05-21 12:50:43 UTC
Permalink
Post by Ryan Kelly
see in the process list in task manager, convert.exe, is taking large
amounts of CPU time/memory initially, then "slowing down"
See http://www.imagemagick.org/script/architecture.php#cache. Your
images are cached to disk and disk is 1000 times slower than memory.
The task will complete as long as you have plenty of temporary disk space
available. For large conversions we recommend caching all images to disk
to reduce memory consumption and possible thrashing of memory / swap.
Add -limit area 0 to your command line.

If you only need a page or two from your large PDF, you can reduce run-time
by specifying which pages you need:

convert image.pdf[0] image.jpg

Loading...