Page 1 of 1

Convert from PDF to Image very slow

Posted: 2018-04-08T04:38:28-07:00
by LittleKI
Hi,

i use this command to convert pdf files to image files

Code: Select all

convert -density 600x600 -units pixelsperinch input -background white -alpha background -alpha off -scene 1 -resize 50% -compress jpeg +adjoin output
but thats extremely slow compared to the windows tool PDFXChange Viewer that i used so far. it takes 2 or 3 minutes until the program starts writing the image files. is this normal? is there something wrong with the command?

i'm on ubuntu 16.04, imagemagick version is 6.8.9-9. my system is a gigabyte p55-ud3, intel i5-760 with 8gb ram.

Re: Convert from PDF to Image very slow

Posted: 2018-04-08T06:10:29-07:00
by snibgo
LittleKI wrote:is this normal?
It depends on the size of your PDFs: the number of pages, and the pixels per page. IM converts all the pages to raster, then saves each one. This might need more memory than you have available, so IM uses disk, which is slow.

Re: Convert from PDF to Image very slow

Posted: 2018-04-08T07:27:30-07:00
by LittleKI
It depends on the size of your PDFs: the number of pages, and the pixels per page.

this is clear, but other tools working faster with the same pdf. maybe they are working different? can i change this when using IM?

Re: Convert from PDF to Image very slow

Posted: 2018-04-08T07:38:06-07:00
by snibgo
This is the way ImageMagick works. If your command asks for the entire PDF document, it will all be converted in memory before any images are written.

You can limit the PDF conversion to certain pages, eg with "mydoc.pdf[10-19]". If you have a large PDF, a script can find how many pages there are and have a loop to convert, say, ten pages in each pass.