加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

用PHP从pdf中提取图像

发布时间:2020-12-13 17:14:05 所属栏目:PHP教程 来源:网络整理
导读:我正试图用 PHP从PDF中提取图像. 我已成功部分成功 – 我有一个灰度图像…… ……我知道我必须在它上面应用一个配方才能获得颜色! 但首先,我需要将图像的二进制数据转换为数字,然后应用the Adobe PDF specs中的公式. 所以基本上,假设你有附加的图像(包含来
我正试图用 PHP从PDF中提取图像.

我已成功部分成功 – 我有一个灰度图像……

……我知道我必须在它上面应用一个配方才能获得颜色!

但首先,我需要将图像的二进制数据转换为数字,然后应用the Adobe PDF specs中的公式.

所以基本上,假设你有附加的图像(包含来自PDF的所有数据,没有修改),它就是

1. CYMK image
2. 8 bit for each component

并且您需要使用附加Adobe规范在“图像”部分下使用PHP将其转换为彩色图像.

我该怎么做才能解决这个问题?

解决方法

你可以使用 pdfimages.

安装xpdf时会安装该软件包.该联机帮助页描述:

Pdfimages saves images from a Portable Document Format (PDF) file as Portable Pixmap (PPM),Portable Bitmap (PBM),or JPEG files.

Pdfimages reads the PDF file,scans one or more pages,PDF-file,and writes one PPM,PBM,or JPEG file for each image,image-root-nnn.xxx,where nnn is the image number and xxx is the image type (.ppm,.pbm,.jpg).

NB: pdfimages extracts the raw image data from the PDF file,without performing any additional transforms. Any rotation,clipping,color inversion,etc. done by the PDF content stream is ignored.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读