Skip to content

Commit 25d77b1

Browse files
Create PDFTOIMGCONVERTOR.py
1 parent 53f3688 commit 25d77b1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

PDFTOIMGCONVERTOR.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# PDF to Images
2+
# pip install PyMuPDF
3+
import fitz
4+
5+
def pdf_to_image_converter(pdf_file):
6+
doc = fitz.open(pdf_file)
7+
for p in doc:
8+
pixels = p.get_pixmap()
9+
image = f"page{p.number}.png"
10+
pixels.writePNG(image)
11+
12+
pdf_to_image_converter("test.pdf")

0 commit comments

Comments
 (0)