Create thumbnail image (jpg/png) of PDF file using Python

S

sophie_newbie

Is there any way to do this directly within python?

If not is there any other good way to achieve it?

Thanks in advance for any help!
 
R

Robin Becker

sophie_newbie said:
Is there any way to do this directly within python?

If not is there any other good way to achieve it?

Thanks in advance for any help!

I have used ghostscript from within python to do this sort of thing. You may get
problems if the fonts are too exotic, but otherwise it works quite well. If that
sounds OK I can send you a script that I use.
 
S

sophie_newbie

Is there any way to do this directly within python?

If not is there any other good way to achieve it?

Thanks in advance for any help!

I think I've solved this problem using a piece of software called
imageMagick. Good stuff so it is.
 
G

golfshoe

I think I've solved this problem using a piece of software called
imageMagick. Good stuff so it is.

Interesting. I wonder if GS can be used to convert PDF To JPG and JPG back to PDF? Pillow is a better alternative to PIL if you are in need of compiling on a Mac.
 
D

Dennis Lee Bieber

Interesting. I wonder if GS can be used to convert PDF To JPG and JPG back to PDF? Pillow is a better alternative to PIL if you are in need of compiling on a Mac.

Unless you have a module that can perform not only character
recognition but ALSO font recognition, I'd have to say "NO".

Embedding a bitmap image (the JPEG data) into a PDF file is NOT the
same as having ASCII (ISO-Latin-1, UTF8, whatever) TEXT strings that are
rendered using instructions for position, type-face, device resolution,
color, etc.

PDF is not an "image" file format; it is a "program" describing how
to render each page. Some of the page contents can be image bitmap data,
but a "proper" PDF has text AS text.
 
C

Chris Angelico

       PDF is not an "image" file format; it is a "program" describing how
to render each page. Some of the page contents can be image bitmap data,
but a "proper" PDF has text AS text.

Plus, JPG is very poor at handling text. It's designed for photos and
photo-like images.

I would recommend using PNG for the bitmapped side.

ChrisA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top