PDF to image conversion question

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
armagan

PDF to image conversion question

Post by armagan »

When I convert a PDF file to PNG I get this rough edges all over the text. How can I convert it anti-aliased? I tried this command:

"convert -density 150 -colorspace RGB -units PixelPerInch a.pdf a.png"

You can see the screenshot of the actual PDF file and the result PNG:

Image
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: PDF to image conversion question

Post by Bonzo »

Try a higher denisty, also read the image in first. I would also look at a quality setting http://www.imagemagick.org/script/comma ... hp#quality

Code: Select all

"convert -density 400 a.pdf -colorspace RGB -units PixelPerInch a.png"
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: PDF to image conversion question

Post by magick »

Add -resize 25% if you want to reduce the final image size. Also investigate Ghostscript fonts. The default fonts are not the best and you will get better results if you provide commercial quality fonts to Ghostscript.
armagan

Re: PDF to image conversion question

Post by armagan »

Higher density combined with resize did the trick, thanks a lot.

Another question: When I convert the pdf to gif it creates a single animated gif. How can I convert to separate gif files? I checked options page but couldn't see anything for this.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: PDF to image conversion question

Post by magick »

You can create separate image files with the +adjoin option or even better embed %02d in your filename:
  • convert image.pdf image-%02d.gif
armagan

Re: PDF to image conversion question

Post by armagan »

magick wrote:You can create separate image files with the +adjoin option or even better embed %02d in your filename:
  • convert image.pdf image-%02d.gif
Thanks a lot, you rock.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: PDF to image conversion question

Post by anthony »

Of course you
1/ Have to pay for it
2/ its is windows only!

If you are going to pay for a solution I would recommend going to Adobe, the owners of the Postscript and PDF file format. But I don't know what products they have for it.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF to image conversion question

Post by fmw42 »

too many post of commercial tools to convert PDF files to images recently on this forum!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: PDF to image conversion question

Post by anthony »

Perhaps a post to the Kudos and Rants area is in order?

I don't mind hearing about alternative solutions, as long as it is only the once.
I would prefer free solutions though.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
shrikantkh
Posts: 1
Joined: 2016-01-21T15:05:23-07:00
Authentication code: 1151

Re: PDF to image conversion question

Post by shrikantkh »

Hi,
I have 55 pages pdf document and trying to convert each page in jpg/png. but getting below error, can some one please help me and tell me how we can do pdf to image conversion for multipage PDF document?


C:\ImageMagic\ImageMagick-6.9.3-1-portable-Q16-x64>convert test.pdf image-%
02d.png
convert.exe: FailedToExecuteCommand `"gswin32c.exe" -q -dQUIET -dSAFER -dBATCH -
dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEV
ICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" "-sOutputFile=C
:/Temp/magick-9568gAo94o_OQzfS%d" "-fC:/Temp/magick-9568oVHaeshaJqPT" "-fC:/Temp
/magick-95680eCkiAcmOUsf"' (The system cannot find the file specified.
) @ error/delegate.c/ExternalDelegateCommand/480.
convert.exe: PDFDelegateFailed `The system cannot find the file specified.
' @ error/pdf.c/ReadPDFImage/800.
convert.exe: NoImagesDefined `image-%02d.png' @ error/convert.c/ConvertImageComm
and/3241.

Thank you
SK
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF to image conversion question

Post by fmw42 »

In the future, please do not tack on new questions to old topics. Also always provide your platform (as well as IM version, though you have that here).

Looks like a problem with your Ghostscript. Do you have it installed?
Post Reply