i have two, one page pdf files im testing this on. heres the code im using (in a php script)
exec('convert -density 300x300 plan.pdf -crop 2880x2880 plan.jpg');
if i take out "-density 300x300" it defaults to 72, which makes the jpg a lot smaller than the original pdf(it needs to stay the same size). also if that is removed, everything works fine, i just have a smaller image. however, the way it currently is, it will only work on the smaller pdf (135KB, 7000x5000 px). on the larger pdf (1.28MB, 10800x14400 px) it doest ever finish. i sometimes get a few pieces of the picture but thats about all. if i take out "-crop 2880x2880" i get nothing at all on the larger pdf. any ideas as to why the conversion isnt working?
thanks
converting pdf only works sometimes
Re: converting pdf only works sometimes
I guess i wasnt giving this enough time. it took about 30 min. but the following finally worked as expected:
exec('convert -density 300x300 plan.pdf -crop 2880x2880 plan.jpg');
however, if i remove "-crop 2880x2880" still dont get any results. a file "plan.jpg" is generated on the server, but has a size of 0KB and no content.
any ideas of what to do to speed this up?
exec('convert -density 300x300 plan.pdf -crop 2880x2880 plan.jpg');
however, if i remove "-crop 2880x2880" still dont get any results. a file "plan.jpg" is generated on the server, but has a size of 0KB and no content.
any ideas of what to do to speed this up?
Re: converting pdf only works sometimes
To speed up the conversion, use Ghostscript instead of ImageMagick to convert PDF to JPEG.
Re: converting pdf only works sometimes
thank you for the quick reply. i dont really know a whole lot here. i tried the following
exec('gs -q -dNOPAUSE -sDEVICE=jpeg -dJPEGQ=100 -r300-sOutputFile=plan2.jpg plan2.pdf');
but i did not get any results. do you have any more advice, or could you point me somewhere where i could find some more info?
thanks again
exec('gs -q -dNOPAUSE -sDEVICE=jpeg -dJPEGQ=100 -r300-sOutputFile=plan2.jpg plan2.pdf');
but i did not get any results. do you have any more advice, or could you point me somewhere where i could find some more info?
thanks again
Re: converting pdf only works sometimes
i also tried to take the pdf, convert it in photoshop, so now i have a jpg 10400x14400 px, and just work with that.
exec('convert -crop 2880x2880 plan.jpg');
i thought maybe i can work around converting from pdf and just go straight to cropping. however, this approach also took a long time to complete. any thoughts?
exec('convert -crop 2880x2880 plan.jpg');
i thought maybe i can work around converting from pdf and just go straight to cropping. however, this approach also took a long time to complete. any thoughts?
Re: converting pdf only works sometimes
See http://www.imagemagick.org/script/architecture.php. When your image gets larger so does the memory requirements. Eventually ImageMagick cannot allocate enough memory so it caches the image pixels to disk which is quite slow as you experienced. Your only options are to accept it is slow, add more memory to your computer, or use some other program other than ImageMagick.