gpt4 book ai didi

php - 使用php从pdf中提取图像

转载 作者:可可西里 更新时间:2023-10-31 23:07:35 25 4
gpt4 key购买 nike

我正在尝试使用 PHP 从 PDF 中提取图像。

我已经部分成功了 - 我有一个灰度图像......

gray scale image from pdf

...而且我知道我必须对其应用公式才能获得颜色!

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

所以基本上,假设您有附加图像(包含 PDF 中的所有数据,没有修改)并且它是

1. CYMK image
2. 8 bit for each component

并且您需要使用附加的 Adob​​e 规范,在“图像”部分下使用 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.

关于php - 使用php从pdf中提取图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13173561/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com