我需要从一个特定的PDF文件中渲染或获取所有图像。如何使用Ghostscript或ImageMagick实现这一点?
发布于 2013-06-25 03:35:35
你不能用Ghostscript做这件事,但是你可以用弹出器的命令行工具或者名为pdfimages
的XPDF命令行工具来做
pdfimages -j some.pdf subdir/image-prefix
所有图像现在都将位于名为image-prefix-0001.jpg
,image-prefix-0002.jpg
的subdir/
中...
-j
参数将使命令尝试直接提取JPEG。如果无法创建JPEG,它将创建PNM或PPM,您始终可以使用ImageMagick对其进行转换:
convert subdir/image-prefix-0033.ppm subdir/image-prefix-0033.jpeg
发布于 2013-06-12 20:23:59
你当然不能在Ghostscript中做到这一点,除非你自己编写了一个Ghostscript设备。
我怀疑你也不能用ImageMagick做到这一点。
你看过PDFtk吗?
如果你使用的是Windows操作系统,那么会出现一个快速的谷歌搜索结果:
http://www.somepdf.com/some-pdf-image-extract.html
在Linux上:
https://askubuntu.com/questions/150100/extracting-images-from-a-pdf
发布于 2016-05-15 07:22:21
解压1个页面的示例:
gs -q -dBATCH -dNOPAUSE -sDEVICE=pnggray -d300 -dFirstPage=1 -dLastPage=1 -sOutputFile=1.tiff in.pdf
https://stackoverflow.com/questions/17065274
复制相似问题