将PDF转换为图像


20

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

当我使用转换这样的

convert book.pdf book.jpg

或像这样

convert book.pdf book.png

然后我得到这个警告

Warning: Short look-up table in the Indexed color space was padded with 0's

每页。

我是否可以使用其他一些工具进行转换以获取一堆图像,或者有人可以向我展示解决该问题的其他方法?


1
看到这个答案:askubuntu.com/a/50180/19053
— dAnjou 2013年

或按照对同一问题的答案中的建议使用GIMP askubuntu.com/a/50175/40581
— LiveWireBT

Answers:


16
convert -geometry 1600x1600 -density 200x200 -quality 100 file.pdf file.jpg

转换为jpg时,可以使用-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

16

一种不同的方式是GhostScript:

gs -dNOPAUSE -dBATCH -sDEVICE=jpeg -r96 -sOutputFile='page-%00d.jpg' input.pdf

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

输出为多张JPEG图像。

您也可以根据需要生成透明的PNG:

gs -dNOPAUSE -dBATCH -sDEVICE=pngalpha -r96 -sOutputFile='page-%00d.png' input.pdf

很好的方法
— Sabacon

2
+1未使用imagemagick
— TheHippo

如何使图像的背景变为白色而不是透明?
— 拉苏尔2014年

不使用pngalptha设备吗?
— zetah 2014年

如何在此定义宽度?需要根据宽高比定义宽度,并自动设置高度。
— Vivek Sancheti
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.