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

Discussion in 'Python' started by sophie_newbie, Nov 20, 2007.

  1. 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!
     
    sophie_newbie, Nov 20, 2007
    #1
    1. Advertising

  2. sophie_newbie

    Robin Becker Guest

    sophie_newbie wrote:
    > 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.
    --
    Robin Becker
     
    Robin Becker, Nov 20, 2007
    #2
    1. Advertising

  3. sophie_newbie

    Guest

    On Nov 20, 11:36 am, sophie_newbie <> wrote:
    > 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!


    Take a look at PIL -- http://www.pythonware.com/products/pil/. Among
    other things, it allows you to easily create thumbnails.

    --Nathan Davis
     
    , Nov 20, 2007
    #3
  4. On Nov 20, 5:36 pm, sophie_newbie <> wrote:
    > 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.
     
    sophie_newbie, Nov 21, 2007
    #4
  5. sophie_newbie

    Guest

    On Wednesday, November 21, 2007 1:16:55 PM UTC-5, sophie_newbie wrote:
    > On Nov 20, 5:36 pm, sophie_newbie
    > wrote:
    > > 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.


    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.
     
    , Jun 14, 2012
    #5
  6. On Thu, 14 Jun 2012 10:35:27 -0700 (PDT), declaimed
    the following in gmane.comp.python.general:

    > 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.

    --
    Wulfraed Dennis Lee Bieber AF6VN
    HTTP://wlfraed.home.netcom.com/
     
    Dennis Lee Bieber, Jun 15, 2012
    #6
  7. On Fri, Jun 15, 2012 at 9:15 AM, Dennis Lee Bieber
    <> wrote:
    >        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
     
    Chris Angelico, Jun 16, 2012
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Morris [Droopy Eyes Software]

    How do I create a thumbnail of a JPG

    Peter Morris [Droopy Eyes Software], Feb 5, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    588
  2. Al
    Replies:
    2
    Views:
    545
  3. bharath
    Replies:
    4
    Views:
    3,186
    Thomas Fritsch
    Mar 16, 2007
  4. Replies:
    0
    Views:
    473
  5. Erwin
    Replies:
    2
    Views:
    129
    Erwin
    May 7, 2008
Loading...

Share This Page