Results 1 to 10 of 10

Thread: Convert PDF to JPG or PNG?

  1. #1
    Join Date
    Oct 2005
    Beans
    466

    Convert PDF to JPG or PNG?

    Hi, does anyone have any solution for converting a pdf to an image on Ubuntu?

    Thanks in advance,

    Johnsie

  2. #2
    Join Date
    Jun 2008
    Location
    California
    Beans
    2,271
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Convert PDF to JPG or PNG?

    You can use the convert command-line utility. It's part of the Imagemagick suite and can be installed through synaptic.

    To convert a PDF file to PNG format, the command would be:

    Code:
    convert infile.pdf outfile.png
    The following page provides more detail:

    http://www.imagemagick.org/script/convert.php

    And, the following page lists formats supported by convert:

    http://www.imagemagick.org/script/formats.php
    Last edited by kaibob; November 26th, 2008 at 06:40 AM.

  3. #3
    Join Date
    Oct 2005
    Beans
    466

    Re: Convert PDF to JPG or PNG?

    Thanks, that worked but the size of the image was alot smaller than the pdf. Is there a way to keep the same page dimensions?

  4. #4
    Join Date
    Jun 2006
    Location
    Switzerland
    Beans
    Hidden!
    Distro
    Kubuntu Jaunty Jackalope (testing)

    Re: Convert PDF to JPG or PNG?

    open the pdf in gimp and save it as .jpg or .png

  5. #5
    Join Date
    Aug 2008
    Beans
    29

    Re: Convert PDF to JPG or PNG?

    or you can tell 'convert' which size

    usually more dots per inch [dpi] works. I'm not sure what's convert's default value but 300dpi or 600dpi are in general good values as you convert vector graphics to raster graphics (that's why you can zoom in in good pdfs and it wont get pixely while it does on pngs)

    Edit:
    small example: An 8x11 letter/A4 (approx) with 72 dpi will result in a 576x792 pixel image -> quite crappy for a whole page, isn't it? Better with 300 dpi: 8x11 -> 2400 x 3300 pixel image, somehow better, isn't it?
    Last edited by phillies; November 26th, 2008 at 10:53 AM. Reason: example added

  6. #6
    Join Date
    Feb 2007
    Location
    Hannover, Germany
    Beans
    7
    Distro
    Ubuntu Jaunty Jackalope (testing)

    Re: Convert PDF to JPG or PNG?

    This answer might be a bit late, but perhaps good for the archive. I had a similar problem before. Change a bunch of oddly sized pdf documents to A4 format (portrait).

    First, use pdftk to rotate the pictures:
    Code:
    pdftk your_input_file.pdf cat 1-endW output rotated.pdf
    Then, use imagemagicks convert to generate a ps file, I used -density 300 to get a resonable 300dpi resolution, you might want more or less.
    Code:
    convert -density 300 rotated.pdf rotated.ps
    And finally, use ghostscript to get everything in A4 format
    Code:
    gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=a4 -sOutputFile=output.pdf rotated.ps
    Of course this can be done using other tools, but I am very happy with all these utilities and the fact that I can use them from the commandline.

  7. #7
    Join Date
    Jan 2007
    Beans
    60

    Re: Convert PDF to JPG or PNG?

    I have 32 pages of pdf file and I want to convert it to png file with 4 images per page. Please show me how to do it. I have searched help but no luck.
    Many thanks.

  8. #8
    Join Date
    Aug 2007
    Beans
    876
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Convert PDF to JPG or PNG?

    Quote Originally Posted by gusanto View Post
    I have 32 pages of pdf file and I want to convert it to png file with 4 images per page. Please show me how to do it. I have searched help but no luck.
    Many thanks.
    Perhaps you could open the pdf in evince, -> print to file -> page setup -> pages per side, and use 4? After the the new pdf with 4 pages per side has been created you can turn it into a png document using:

    Code:
    convert 4pages_per_side.pdf 4pages_per_side.png

  9. #9
    Join Date
    Aug 2010
    Beans
    407
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Convert PDF to JPG or PNG?

    Quote Originally Posted by Dewni View Post
    This answer might be a bit late, but perhaps good for the archive.
    I just want to say thanks for adding answers 'for the archive'!

    Googling brought me here to find out how to convert, rotate, and resize a PDF to JPG without losing the quality of the results (the key being keeping the quality to a reasonable level).

    These three commands came in useful:

    To convert a PDF to PNG with reasonable quality:
    convert -density 300 file.pdf file.png

    To rotate a PDF:
    pdftk nonrotated.pdf cat 1-endW output rotated.pdf

    To size a PDF to a desired size (this example is A4 but I would want 8.5x11):
    gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=a4 -sOutputFile=output.pdf input.ps

  10. #10
    Join Date
    Feb 2012
    Beans
    1

    Re: Convert PDF to JPG or PNG?

    Thank you it really worked for converting and size as well.
    Thanks all

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •