PDFs to thumbnails
September 11, 2008 3:16 PM   Subscribe

I have an ordering centre for books and other written materials. I have PDFs of the books, but I don't have images of the covers. I want to make thumbnails of the covers to help people recognise the item they are looking for. How can I generate thumbnails from the first page of the PDFs?

I've googled high and low. I've seen PDF Thumbnail Generator and I can't seem to get it to work. Maybe it doesn't do what I'm looking for.

I don't know how to use C# code or ASPX or any of those scripty solutions. My searches have led me to various sourceforge projects, but I don't know enough to judge good code from bad, and I don't want to inspire the wrath of my sysadmin by downloading and running something that's coded poorly.

Is there an .exe somewhere that can do this? Maybe it could grab the icons from thumbs.db?

I have access to Windows XP and Mac OSX. I have Adobe Professional 6.0 and I could convince my boss to get version 7.0 if necessary.

I've been doing screenshots and resizing them manually, but we have hundreds of items to go through and I just don't have the time it would take. Please tell me there's a way to do this automagically!
posted by heatherann to Computers & Internet (6 answers total) 1 user marked this as a favorite
 
Best answer: Have Photoshop? It can open PDF files (and you can tell it to open only page 1). With PS, you have scripty power that doesn't involve writing scripts. I don't have it in front of me, but:

1. Create a new action.
2. Click record.
3. Open a PDF you'd like to make a thumbnail of.
4. Choose page 1 only.
5. Image->Image Size->Enter desired size
6. Save in desired format.
7. Hit stop.
8. File->Automate->Batch (or make a droplet).
posted by fake at 3:33 PM on September 11, 2008


I'm using Acrobat Pro 7 here, but I seem to remember you can do this as far back as version 4.

Go to Document -> Extract Pages... -> and extract the first page of the PDF you're working on. This should open the page up in a new window.

Then go to File -> Export -> Image -> and select whichever format you want to save the cover as. You can choose JPEG, TIFF or PNG.

You'll likely have to resize the image in photoshop afterward.

Alternately, you can simply open the cover page in Photoshop and do your work from there. Now that I think about it, you could probably use Photoshop to create a Droplet that will open, resize, and save the file without any input from you. Start it up and walk away.

I'm going to experiment with this. I'll let you know what I find.

Or, on preview, what fake said already.
posted by lekvar at 3:42 PM on September 11, 2008


Best answer: I have had to solve this problem with thousands of PDF files and feel your pain. It took me months to hit upon a solution.

On Mac OSX you can use a command-line utility known as sips that comes with the Mac. Open up terminal and:

cd THE_DIRECTORY_WITH_THE_PDFS

for file in `ls -1 *.pdf`; do sips -s format jpeg --resampleWidth 150 $file --out $file.jpg; done (all on one line)

That will generate one jpg per pdf. It will be a thumbnail of the first page; it will be 150 pixels wide.

The basic command is:

sips -s format jpeg --resampleWidth [width in pixels] [pdf-file] --out [jpeg-thumbnail-file]

Not the tiniest-ever jpgs, but pretty good.
posted by ftrain at 4:32 PM on September 11, 2008 [4 favorites]


Woah, that's pretty cool, ftrain.
posted by lekvar at 4:43 PM on September 11, 2008


Response by poster: ftrain, I've adored your writing for years, and now I heart you even MORE. :)

One question: When I have sample.pdf, it generates sample.pdf.jpg. How can I get it to generate sample.jpg instead?
posted by heatherann at 8:41 AM on September 12, 2008


This should work:

for file in `ls -1 *.pdf|sed 's/.pdf//'`; do sips -s format jpeg --resampleWidth 150 $file.pdf --out $file.jpg; done

If some of the PDFs are named *.PDF instead of *.pdf the above will not catch them. You should run the command twice, and the second time should be:

for file in `ls -1 *.PDF|sed 's/.PDF//'`; do sips -s format jpeg --resampleWidth 150 $file.PDF --out $file.jpg; done

And thank you--I'm glad you like my writing.
posted by ftrain at 1:37 PM on September 13, 2008


« Older Where does THIS book go?   |   Recommend software to replace fax machine, please? Newer »
This thread is closed to new comments.