Convert a pdf to an image format with imagemagick

This is a discussion on Convert a pdf to an image format with imagemagick within the PHP Language forums, part of the PHP Programming Forums category; Hi to all!!! I'm trying to convert a pdf file into an image, for example JPG or PNG format, ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-23-2007
femtox77@gmail.com
 
Posts: n/a
Default Convert a pdf to an image format with imagemagick

Hi to all!!!

I'm trying to convert a pdf file into an image, for example JPG or PNG
format, with ImageMagick. I use the command line. For example: convert
header.pdf header.jpg. But I obtain a bad result. The jpg's quality is
very low. Why? I tried to use - quality 100 option but there isn't
improvement. I think also that this option isn't active for the pdf
conversion to an image format or not? I need some good ideas :D...

Thanks to all

fem

Reply With Quote
  #2 (permalink)  
Old 07-23-2007
Bill Segraves
 
Posts: n/a
Default Re: Convert a pdf to an image format with imagemagick

<femtox77@gmail.com> wrote in message
news:1185204380.330805.101900@r34g2000hsd.googlegr oups.com...
> Hi to all!!!
>
> I'm trying to convert a pdf file into an image, for example JPG or PNG
> format, with ImageMagick.


You could also use the online version at
http://redux.imagemagick.org/MagickS...gickStudio.cgi.

> I use the command line. For example: convert
> header.pdf header.jpg. But I obtain a bad result. The jpg's quality is
> very low. Why? I tried to use - quality 100 option but there isn't
> improvement. I think also that this option isn't active for the pdf
> conversion to an image format or not? I need some good ideas :D...


ImageMagick cannot improve the quality of an image embedded in a PDF.

When the PDF was created, the resolution of the embedded image was
established by Acrobat (if Acrobat was used to create it), probably via a
default setting in Distiller that causes the image to be downsampled to an
appropriate setting for web/screen viewing, i.e., 72 dpi for Acrobat
(Distiller) 3.

--
Bill Segraves


Reply With Quote
  #3 (permalink)  
Old 07-24-2007
gosha bine
 
Posts: n/a
Default Re: Convert a pdf to an image format with imagemagick

On 23.07.2007 17:26 femtox77@gmail.com wrote:
> Hi to all!!!
>
> I'm trying to convert a pdf file into an image, for example JPG or PNG
> format, with ImageMagick. I use the command line. For example: convert
> header.pdf header.jpg. But I obtain a bad result. The jpg's quality is
> very low. Why? I tried to use - quality 100 option but there isn't
> improvement. I think also that this option isn't active for the pdf
> conversion to an image format or not? I need some good ideas :D...
>
> Thanks to all
>
> fem
>


hi there

ImageMagick doesn't actually convert pdfs, all it does is to invoke
Ghostscript. You might want to call GS directly to gain more control
over it. Example of a GS command:

gs -q -sDEVICE=jpeg -dBATCH -dNOPAUSE -dFirstPage=1 -dLastPage=1
-r<OUTPUT RESOLUTION> -sOutputFile=<OUTPUT>.jpg <INPUT>.pdf 2>&1

this rasterizes first page of <INPUT>.pdf into <OUTPUT>.jpg with
resolution 300.



--
gosha bine

makrell ~ http://www.tagarga.com/blok/makrell
php made right ;) http://code.google.com/p/pihipi
Reply With Quote
  #4 (permalink)  
Old 07-24-2007
femtox77@gmail.com
 
Posts: n/a
Default Re: Convert a pdf to an image format with imagemagick

On 24 Lug, 09:54, gosha bine <stereof...@gmail.com> wrote:
> On 23.07.2007 17:26 femto...@gmail.com wrote:
>
> > Hi to all!!!

>
> > I'm trying to convert a pdf file into an image, for example JPG or PNG
> > format, with ImageMagick. I use the command line. For example: convert
> > header.pdf header.jpg. But I obtain a bad result. The jpg's quality is
> > very low. Why? I tried to use - quality 100 option but there isn't
> > improvement. I think also that this option isn't active for the pdf
> > conversion to an image format or not? I need some good ideas :D...

>
> > Thanks to all

>
> > fem

>
> hi there
>
> ImageMagick doesn't actually convert pdfs, all it does is to invoke
> Ghostscript. You might want to call GS directly to gain more control
> over it. Example of a GS command:
>
> gs -q -sDEVICE=jpeg -dBATCH -dNOPAUSE -dFirstPage=1 -dLastPage=1
> -r<OUTPUT RESOLUTION> -sOutputFile=<OUTPUT>.jpg <INPUT>.pdf 2>&1
>
> this rasterizes first page of <INPUT>.pdf into <OUTPUT>.jpg with
> resolution 300.
>
> --
> gosha bine
>
> makrell ~http://www.tagarga.com/blok/makrell
> php made right ;)http://code.google.com/p/pihipi


Really thanks, now I try this method...

Femtox

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:22 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0