Discussion:
[poppler] Command line pdf to high resolution jpegs conversion?
D***@terra.es
2007-03-11 11:49:28 UTC
Permalink
I am looking for a way to convert a pdf to high resolution jpegs to read
pdfs at my digital camera.

Do you know of any opensource (command line) program that can convert
pdfs to jpegs (maybe using poppler)?



Ahora también puedes acceder a tu correo Terra desde el móvil.
Infórmate pinchando aquí.
Martin Schröder
2007-03-11 16:17:35 UTC
Permalink
Post by D***@terra.es
Do you know of any opensource (command line) program that can convert
pdfs to jpegs (maybe using poppler)?
The next time try Google first.

convert (comes with ImageMagic)
ghostscript

Best
Martin
D***@terra.es
2007-03-12 11:11:09 UTC
Permalink
Post by Martin Schröder
Post by D***@terra.es
Do you know of any opensource (command line) program that can convert
pdfs to jpegs (maybe using poppler)?
The next time try Google first.
I tried Google. That is why I am posting here.
Post by Martin Schröder
convert (comes with ImageMagic)
It is painfully slow, gives not the good quality that poppler and cairo
does and I do not know how to make high resolution images.
Post by Martin Schröder
ghostscript
convert uses ghostscript so the quality is as bad.
(poppler+cairo is supposed to give much more quality, right?)

You should send any references to using any of the programs you mention
because I could not find any good docs about using them to output high
resolution jpegs.



Ahora también puedes acceder a tu correo Terra desde el móvil.
Infórmate pinchando aquí.
Martin Schröder
2007-03-14 15:26:42 UTC
Permalink
Post by D***@terra.es
It is painfully slow, gives not the good quality that poppler and cairo
does and I do not know how to make high resolution images.
poppler is no RIP.
Post by D***@terra.es
Post by Martin Schröder
ghostscript
convert uses ghostscript so the quality is as bad.
(poppler+cairo is supposed to give much more quality, right?)
I doubt it; they are optimized and intended for screen use.

Try
gs -sDEVICE=jpeg -sOutputFile=test.jpg -r1000 -dBATCH -dLastPage=1
-dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dNOPAUSE test.pdf

Best
Martin
Carl Worth
2007-03-14 16:54:04 UTC
Permalink
Post by D***@terra.es
Do you know of any opensource (command line) program that can convert
pdfs to jpegs (maybe using poppler)?
Here's a tiny little command-line program that Kristian wrote for use
in the cairo test suite, (and I converted it from using GdkPixbuf to
using straight poppler-to-cairo rendering).

It doesn't meet your exact requirements, but it should be fairly
straightforward for someone knowledgeable in C or shell scripting to
adapt it to your needs.

It's a C program that you should be able to compile as follows:

cc $(pkg-config --cflags --libs poppler-glib poppler-cairo) -o pdf2png pdf2png.c

Then, you can run it to produce a PNG image of a single page of a PDF
file as follows, (the final number on the command-line specifies which
page to extract):

./pdf2png input.pdf output.png 1

Then you could convert the output from PNG to jpeg with pnmtools:

pngtopnm < output.png | pnmtojpeg > output.jpg

So perhaps that's helpful,

-Carl

Loading...