4

I've run my course with ImageMagick and Ghostscript. I left it alone to get on with other areas of development and for the entire day I've been trawling forums trying to get ImageMagick to work on my CentOS server and am now at a point where I could cry with frustration......

Is there a less flaky solution to simply convert an all text PDF into a jpg thumbnail so I can get this headache over and done with? Nobody seems to know what "Postscript Delegate Failed" means and I don't know how many times I'm meant to install, remove, reinstall, ./configure, make, make install, tar, feather, hang, draw and quarter Ghostscript and all the devel libraries... how difficult can it be to convert a PDF to a thumbnail?????

Help!! Please!!!!

2 Answers 2

1

On CentOS?

 /usr/bin/evince-thumbnailer --help
Usage:
  evince-thumbnailer [OPTION...] <input> <ouput> - GNOME Document Thumbnailer

Help Options:
  -h, --help             Show help options

Application Options:
  -s, --size=SIZE   

It produces PNG's; easily converted. The -s SIZE option seems to represent the minimum dimension, preserving aspect-ratio. (A US Letter sized file at -s 128 for me produced 128×166 px PNG.)

It's in the evince package.

10
  • I just installed and tried it and it gives no error messages, but it also gives no thumbnails either :(
    – Raath
    Dec 14, 2011 at 16:56
  • Sounds like perhaps there are bigger problems afoot there … does rpm -q --verify evince show the package and dependencies are installed properly? Is the output filename you passed in a directory without write permissions? Works for me on ( CentOS 5, Fedora 15, Fedora 16 )…
    – BRPocock
    Dec 14, 2011 at 17:00
  • I yummed it - yum install evince.
    – Raath
    Dec 14, 2011 at 17:20
  • Found something else though.... By using gs directly I've managed to get the all text PDF to convert, but does anyone know which option to give gs to specify a maximum dimension? The PDF in question is 1040x3700 and I want it to be a maximum of 80px for the thumbnail... Some PDFs could be wide or tall so I need a maximum stat.
    – Raath
    Dec 14, 2011 at 17:22
  • Perhaps there's a permissions-related issue or similar? I presume your user has read permissions on the input and rwx permissions on the directory to contain the output (and rx on the path to that directory), &c (the usual suspects)?
    – BRPocock
    Dec 14, 2011 at 17:23
1

Ok I found a solution. forget about trying to get ImageMagick to convert your PDFs. I've spent months on this and never found a solution.

So instead do this.

Use gs directly to convert the PDF file to a jpeg.

exec("gs -sDEVICE=jpeg -o $tmp_image -dJPEGQ=95 $pdf_name 2>&1");

with the tmp_image in place you can then run the ImageMagick convert app

exec("convert -colorspace RGB ".$tmp_image." -geometry 80x80 -quality 100 ".$thumb_image." 2>&1");

remembering to unlink($tmp_image); to stop clutter. You should have your converted PDF

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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