I have a working PDF to PNG conversion script using PHP and ImageMagick but I am having a problem with the speed of the conversion.
I know it works because with a very small PDF the time taken to convert is not that great, but with a 250kb file (still not that large really) it takes in excess of 20 minutes to convert.
Here's the PHP:
//***** GET PATH TO IMAGEMAGICK *****
$path_to_imagemagick = trim(`which convert`);
//***** PATH TO PDF TO CONVERT *****
$path_to_pdf = getcwd() . "/pdf/myfile.pdf[0]";
//***** PATH TO OUTPUT TO *****
$output_path = getcwd() . "/pdfimage/test_converted.png";
@exec($path_to_imagemagick . " -density 72 -quality 60 -resize 150x " . $path_to_pdf . " " . $output_path);
Are there any settings I can change to make this quicker?
If it helps, the image does not need to be a PNG. If JPEG is going to be quicker I'm happy to go with that.