python 删除pdf 图片

import os
import fitz
doc = fitz.open('D:\888\888\\6.pdf')
imgcount = 0for page in doc:
    imageList = page.get_images()
    print(imageList)
    i = 0
    for imginfo in imageList:
        if 'ICCBased' in str(imginfo):
            print("imginfo", imginfo)
            doc._deleteObject(imageList[i][0])
        i = i + 1
doc.save('222.pdf')

 

posted @ 2024-01-25 17:45  淋哥  阅读(37)  评论(0编辑  收藏  举报