How can I convert a PDF/djvu file to PNGs under Linux?

2

1

Imagemagick doesn't work (Fedora 14) on one PDF file:

$ convert -density 300 INPUT.PDF out.png
Error: /ioerror in --showpage--
Operand stack:
   1   true
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1878   1   3   %oparray_pop   1877   1   3   %oparray_pop   1861   1   3   %oparray_pop   --nostringval--   --nostringval--   141   1   319   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   1761   0   9   %oparray_pop   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1157/1684(ro)(G)--   --dict:1/20(G)--   --dict:75/200(L)--   --dict:75/200(L)--   --dict:108/127(ro)(G)--   --dict:288/300(ro)(G)--   --dict:22/25(L)--   --dict:6/8(L)--   --dict:22/40(L)--
Current allocation mode is local
Last OS error: 27
GPL Ghostscript 8.71: Unrecoverable error, exit code 1
convert: Postscript delegate failed `INPUT.PDF':  @ error/pdf.c/ReadPDFImage/645.
convert: missing an image filename `out.png' @ error/convert.c/ConvertImageCommand/2953.
$ 

It doesn't work on a djvu file:

$ convert -density 300 INPUT.DJVU out.png
convert: no decode delegate for this image format `INPUT.DJVU' @ error/constitute.c/ReadImage/532.
convert: missing an image filename `out.png' @ error/convert.c/ConvertImageCommand/2953.
$

An extra: the output filenames

out-0.png
out-1.png
...
out-9.png
out-10.png
out-11.png
...
out-123.png
out-124.png

Is there a way to be like this?

out-000.png
out-001.png
...
out-009.png
out-010.png
out-011.png
...
out-123.png
out-124.png

Because they would be in wrong order:

out-0.png
out-1.png
out-10.png
out-11.png
out-123.png
out-124.png
out-9.png

LanceBaynes

Posted 2011-01-16T18:21:01.070

Reputation: 3 510

Cross-posted on StackOverflow: http://stackoverflow.com/questions/4707153/convert-a-pdf-djvu-file-to-pngs-under-linux-how

– Bobby – 2011-01-17T16:03:38.170

@user62367 Stop crossposting, this is your last warning – Ivo Flipse – 2011-01-18T00:20:49.070

Answers

1

ImageMagick was compiled without DJVU support. You must recompile it with option: --with-djvu which you can pass to ./configure script.

ont.rif

Posted 2011-01-16T18:21:01.070

Reputation: 26