Created
October 7, 2024 11:56
-
-
Save reddgr/772a3ac4220eabf1981a3828389f1641 to your computer and use it in GitHub Desktop.
Convert all pages of a PDF into images with Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ! pip install pdf2image | |
# Download Poppler: https://github.com/oschwartz10612/poppler-windows/releases/ | |
# Add the /bin Poppler directory to PATH | |
from pdf2image import convert_from_path | |
images=convert_from_path("file_name.pdf", | |
poppler_path="C:/Users/.../Release-24.08.0-0/poppler-24.08.0/Library/bin") # Your path to Poppler binaries | |
for i in range(len(images)): | |
images[i].save('pdf_to_image/page_'+ str(i) +'.jpg', 'JPEG') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment