1 更新Linux py3
https://www.jianshu.com/p/fbb0a6d02855
pip3命令安装 PyMuPDF
import datetime
import os
import sys
import json
import fitz # fitz就是pip3 install PyMuPDF
# 数组转json对象
class A:
def __init__(self,name):
self.name = name
def pyMuPDF_fitz( pdfPath , imagePath , pdfPath_name ):
startTime_pdf2img = datetime.datetime.now() # 开始时间
path_arr = []
# print("imagePath=" + imagePath)
pdfDoc = fitz.open(pdfPath)
for pg in range(pdfDoc.pageCount):
page = pdfDoc[pg]
rotate = int(0)
# 每个尺寸的缩放系数为1.3,这将为我们生成分辨率提高2.6的图像。
# 此处若是不做设置,默认图片大小为:792X612, dpi=96
zoom_x = 1.33333333 # (1.33333333-->1056x816) (2-->1584x1224)
zoom_y = 1.33333333
mat = fitz.Matrix(zoom_x, zoom_y).preRotate(rotate)
pix &#