Problems with image magick

software development


I’m trying to use Image Magick to create some png thumbs of some uploaded pdfs but whenever it creates the thumb it adds _0 to the file name.

So test.pdf would be saved as test_0.png instead of test.png

I’m running the cmd:
/usr/bin/convert -thumbnail 200 absolute_path_to_file absolute_path_to_new_file

I’m not sure why this is happening or if its a setting with Image Magick. Just going by the dreamhost wiki example. Any help is appreciated. Let me know if you need any additional info.


figured it out. it was created a new image for every page in the pdf. need to specify the page you want:

/usr/bin/convert -thumbnail 200 absolute_path_to_file[0] absolute_path_to_new_file

so you only take the first page


Also check the output.

ImageMagick relies on GhostScript for PDF conversion. If on your server there is an older GS version you may get unexpected results with some PDF files.

In that case just compile latest GhostScript, set its directory as the first one in your path and thus let ImageMagick benefit by latest PDF parser.