#ИзвлечениеИзображенийИзPDF



Код из видео:



import fitz



file = 'test.pdf'



pdf = fitz.open(file)



for i in range(len(pdf)):

for image in pdf.getPageImageList(i):

xref = image[0]

pix = fitz.Pixmap(pdf, xref)

if pix.n < 5:

pix.writePNG(f'{xref}.png')

else:

pix1 = fitz.open(fitz.csRGB, pix)

pix1.writePNG(f'{xref}.png')

pix1 = None