首页 > 解决方案 > 如何在 Python 中将 PDF 转换为 TIFF [CCITT Group 4 传真编码压缩]?

问题描述

我有一个 PDF 文件,我想通过 CCITT Group 4 Fax Encoding 的压缩将 PDF 文件拆分为 TIFF 文件格式的图像。我已使用 pdf2image 转换为 TIFF,但无法转换为压缩 CCITT Group 4 Fax Encoding。我使用下面的代码转换为 TIFF。你能帮我压缩 CCITT Group 4 Fax Encoding 格式的 TIFF 图像吗?

from pdf2image import convert_from_path
TIFFPdf = convert_from_path(pdf, poppler_path=config['APPLICATION_LOCATION']['POPPLER_PATH'])

for img in TIFFPdf:
    img.save(str("{:04d}".format(imageId)) + '.tiff', 'TIFF')
    imageId += 1

标签: pythonpython-3.ximagetiffimage-compression

解决方案


推荐阅读