将 PDF 转换为图像

Ubu*_*Guy 20 pdf conversion convert jpeg

我正在尝试将 PDF 文件(它是一本书)转换为图像。

当我像这样使用转换时

convert book.pdf book.jpg
Run Code Online (Sandbox Code Playgroud)

或者像这样

convert book.pdf book.png
Run Code Online (Sandbox Code Playgroud)

然后我收到这个警告

Warning: Short look-up table in the Indexed color space was padded with 0's
Run Code Online (Sandbox Code Playgroud)

对于每一页。

是否有其他工具可以用于转换以获得一堆图像,或者有人可以告诉我解决这个问题的不同方法?

zet*_*tah 17

一种不同的方式是 GhostScript:

gs -dNOPAUSE -dBATCH -sDEVICE=jpeg -r96 -sOutputFile='page-%00d.jpg' input.pdf
Run Code Online (Sandbox Code Playgroud)

-r96所需的 dpi 分辨率在哪里

输出是多个 JPEG 图像。

如果您愿意,您也可以生成透明的 PNG:

gs -dNOPAUSE -dBATCH -sDEVICE=pngalpha -r96 -sOutputFile='page-%00d.png' input.pdf
Run Code Online (Sandbox Code Playgroud)

  • +1 表示不使用 imagemagick (2认同)

One*_*ero 16

convert -geometry 1600x1600 -density 200x200 -quality 100 file.pdf file.jpg
Run Code Online (Sandbox Code Playgroud)

转换为 jpg 时,可以使用 -quality 选项。“最佳”质量将是 -quality 100。

There is a much simpler way to split multipage pdfs into a jpg:

convert -quality 100 -density 600x600 multipage.pdf single%d.jpg

    The -density option defines the quality the pdf is rendered before the convert > here 600dpi. For high quality prints you can increase that number.
    The %d just before the jpg suffix is for automatic numbering of the output pages 0,1,2...
    The -quality option defines the compression quality of the output jpg (0 min ... 100 max)
    The .jpg suffix defines the output format. You could use .png/.jpg/.pdf
Run Code Online (Sandbox Code Playgroud)