tablecat Posted September 14, 2009 Posted September 14, 2009 Hi, I'm trying to thumbnail PDF using ImageMagick but I am unable because -thumbnail appears to do nothing. I've tried this on a seperate free web host just to check if it wasn't just me messing up, and it worked. It is also worth noting that I can, in fact, thumbnail images on this server. My only issue here is trying to thumbnail PDF files, which I haven't been able to on this server. convert -thumbnail 200x200 -colorspace rgb -quality 70 test.pdf test.gif I've tried other methods such as: convert -size 200x200 -geometry 200x200! -colorspace rgb -quality 70 test.pdf test.gif This does correctly thumbnail the PDF to the appropriate dimmensions, however, the image is all black! I would like to know what the issue is here. Thanks.
Byron Posted September 14, 2009 Posted September 14, 2009 I don't have a pdf file to try so I can't say this works for sure. Try using the Imagick Class. <?php $thumb = new Imagick("your_image.pdf"); $thumb->thumbnailimage(200, 200, TRUE); $thumb->setformat("gif"); $thumb->writeimage("thumb_nail.gif"); ?> Keeping it TRUE will produce a thumb that is proportional. Removing TRUE will force height and width.
tablecat Posted September 14, 2009 Author Posted September 14, 2009 I guess I should have said so sooner, I'm using Perl... Sorry It's not proportions that bother me, it's the fact that no thumbnail is generated at all (using the first example of code in my previous post).
Byron Posted September 14, 2009 Posted September 14, 2009 Did you try a pdf file with my php code to see if the server is converting pdfs? Would it be that much of a problem to use php if the code works?
Byron Posted September 14, 2009 Posted September 14, 2009 I did a Google search on converting pdf files and according to the ImageMagick folks you need Ghostscript and I don't think we have that. http://www.imagemagick.org/discourse-serve...;hilit=cmyk+pdf You could make a request for it and see what djbob says.
tablecat Posted September 14, 2009 Author Posted September 14, 2009 need Ghostscript and I don't think we have that. I'm sure that's it. I'm still going to try PHP. Where do I request this feature?
Byron Posted September 14, 2009 Posted September 14, 2009 I'm sure that's it. I'm still going to try PHP. Where do I request this feature? Your still going to need Ghostscript for php too. Hopefully djbob will read this thread and post back to you.
Ashoat Posted September 15, 2009 Posted September 15, 2009 Try installing the Ghostscript module for Perl from your cPanel first, and if that doesn't work I'll do it from root.
Byron Posted September 15, 2009 Posted September 15, 2009 Ghostscript isn't a Perl module. This is what the ImageMadick people said about Ghostscript: "ImageMagick uses the Ghostscript delegate program to render PDF." Here is the Ghostscript site. http://www.ghostscript.com/
Ashoat Posted September 16, 2009 Posted September 16, 2009 I'm not comfortable installing a separate package. Is it available as a module? Also, how is PHP ImageMagick working without Ghostscript?
tablecat Posted September 17, 2009 Author Posted September 17, 2009 Also, how is PHP ImageMagick working without Ghostscript? It doesn't because it has nothing to do with the programming language. ImageMagick uses Ghostscript for thumbnailing PDF files. ImageMagick is called by a covert command, which has nothing to do with programming language used to call the command in the first place. Observe: [17-Sep-2009 15:41:58] PHP Fatal error: Uncaught exception 'ImagickException' with message 'Postscript delegate failed '
Ashoat Posted September 20, 2009 Posted September 20, 2009 Okay, I went ahead and installed Ghostscript. Let me know if your scripts are working now.
Byron Posted September 20, 2009 Posted September 20, 2009 I just tried it on my site and it's still showing the same error. http://byrondallas.heliohost.org/php/imagick/thumbnail.php <?php $thumb = new Imagick("fw4.pdf"); $thumb->thumbnailimage(400, 400, TRUE); $thumb->setformat("gif"); $thumb->writeimage("thumb_nail.gif"); header("Location: thumb_nail.gif"); ?>
Byron Posted September 22, 2009 Posted September 22, 2009 See if this helps you djbob? http://pages.cs.wisc.edu/~ghost/doc/gnu/7.05/Install.htm
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now