pdfimages 从pdf文件中提取图片

在Linux中,如何提取pdf文件中的图片?

解决方案

使用pdfimages可以将pdf文件中的图片提取并保存。

pdfimages 包含在poppler-utils软件包中:
在CentOS RHEL Linux中安装

# yum install poppler-utils

在Debian Ubuntu中安装

# apt-get install poppler-utils

pdfimages语法

语法:

pdfimages /path/to/file.pdf /path/to/output/dir

示例,将bar.pdf文件中的图片提取到/tmp/images

$ pdfimages bar.pdf /tmp/images
$ ls /tmp/image*

将提取的图片以PBM/PPM格式保存:

$ pdfimages -j bar.pdf /tmp/image

-f选项指定扫描开始页。
提取前5页:

$ pdfimages -j -f 5 bar.pdf /tmp/image

-l选项指定扫描结束页
提取最后5页:

$ pdfimages -j -l 5 bar.pdf /tmp/image
日期:2019-11-20 08:53:14 来源:oir作者:oir