
phillip at communitybandwidth
Oct 6, 2008, 7:03 AM
Post #8 of 8
(5976 views)
Permalink
|
|
Re: Image::Magick::Thumbnail::PDF - make thumbnail of a page in a pdf document - search.cpan.org
[In reply to]
|
|
Very cool. Many thanks. Going to give that a go! :-) On 2-Oct-08, at 2:27 PM, Bret Dawson wrote: > We actually have a template that does that now. It only uses > Image::Magick, not the PDF extension, but the process is pretty > simple. > > You can simply read in the first page of the PDF and then resize it > and > output a JPG. Here's a snippet: > > > #create a thumbnail of the first page of the pdf 75 pixels wide > my $image; > $image = new Image::Magick; > $image->Read($pdfFile."[0]"); > $image->Thumbnail('75'); > $image->Set(colorspace=>'RGB'); > $image->Write($tmpFile); > undef $image; > > #now upload our new image > my $fh; > open($fh, "<$tmpFile"); > $newrelmedia->upload_file($fh, $jpgFileName); > close ($fh); > > > Again, this requires Image::Magick. But like I was saying I'm a fan. > > Cheers, > > Bret > > On Thu, 2008-10-02 at 13:57 -0400, Phillip Smith wrote: >> On 1-Oct-08, at 10:04 PM, bharder wrote: >> >>> On Wed, Oct 01, 2008 at 03:52:32PM -0400, Bret Dawson wrote: >>>> Hi everybody, >>>> >>>> If I recall correctly, Image::Magick was actually pretty easy last >>>> time >>>> I tried it. >>>> >>>> Or maybe it was that the Gentoo package installed without >>>> complaint, and >>>> so did the Ubuntu one. Come to think of it, I'm not sure I've ever >>>> compiled it. >>>> >>>> Anyway, my own personal makefile chops = 0, but I've used and >>>> installed >>>> Image::Magick for use in Bricolage templates on at least a couple >>>> of >>>> platforms without any trouble. So let me personally encourace >>>> Phillip to >>>> steam ahead with the plan... >>> >>> I've never had issues compiling either, but fwiw, Image::Magick is >>> nothing but an OO wrapper than shells-out to the usual ImageMagick >>> binaries anyway -- considering imager is already installed, and the >>> feature that's being discussed is only resizing PDFs >> >> Not re-sizing per se, but converting the first page of the PDF to a >> small thumbnail image, e.g.: a jpg, gif, or png. >> >> Ideas on how to do that without using >> Image::Magick::Thumbnail::PDF ? >> >> -- >> Phillip Smith, >> Simplifier of Technology >> Community Bandwidth >> http://www.communitybandwidth.ca >> >> >> >> > -- > Bret Dawson > Producer > Pectopah Productions Inc. > (416) 895-7635 > bret [at] pectopah > www.pectopah.com > -- Phillip Smith, Simplifier of Technology Community Bandwidth http://www.communitybandwidth.ca
|