

The -jpeg sets the output image format to JPG, -r 300 sets the output image resolution to 300 DPI, and the word output will be the prefix to all pages of images, which will be numbered and placed into your current directory you are working in. Good command-use this instead: pdftoppm -jpeg -r 300 input.pdf output Then, I remembered there was another tool I use and wrote about, so I googled "linux convert pdf to jpg Gabriel Staples", clicked the first hit, and scrolled down to my answer. I just googled how to convert a PDF to a JPEG today, found this answer, and tried convert, and it doesn't work at all for me:īroken command (doesn't work for me): $ convert in.pdf out.jpgĬonvert-im6.q16: not authorized `in.pdf' error/constitute.c/ReadImage/412.Ĭonvert-im6.q16: no images defined `out.jpg' error/convert.c/ConvertImageCommand/3258. You can't get higher quality than that.For the life of me, over the last 5 years, I cannot get imagemagick to work consistently (if at all) for me, and I don't know why people continually recommend it again and again. The extracted JPEGs were byte-for-byte identical to the source images. I tried this command on a PDF that I had made myself from a sequence of JPEG images. jpg step (depending on what bitmap format the PDF was using). You may or may not need to follow that with a convert to. By default, pdfimages converts everything to PNM format, and converting JPEG > PPM > JPEG is a lossy process. You probably also want to use the -j option to pdfimages, because a PDF can contain raw JPEG data.

It simply ignores any text or vector drawing commands in the PDF.Īs a result, if what you have is a PDF that's just a wrapper around a series of bitmaps, pdfimages will do a much better job of extracting them, because it gets you the raw data at its original size. Pdfimages looks through the PDF for embedded bitmap images and exports each one to a file. pdfimages does not do the same thing that convert does when given a PDF as input.Ĭonvert takes the PDF, renders it at some resolution, and uses the resulting bitmap as the source image. Update: As you pointed out, gscan2pdf (the way you're using it) is just a wrapper for pdfimages (from poppler). (You can prepend -units PixelsPerInch or -units PixelsPerCentimeter if necessary. Perhaps you need to use -density to do the conversion at a higher dpi: convert -density 300 file.pdf page_%04d.jpg Could you post some samples to illustrate? Perhaps cut the same section out of the poor quality and good quality versions (as a PNG to avoid further quality loss). That could mean a lot of different things. It's not clear what you mean by "quality loss".
