Created
August 11, 2021 16:26
-
-
Save idcesares/7c5e22bb963dd9d57fdf4e48b55f023e to your computer and use it in GitHub Desktop.
Convert a PDF file to image using poppler and pdf2image
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
# Install poppler using chocolatey | |
# choco install poppler | |
# Imports | |
import pdf2image | |
import os | |
# Function to convert PDF to image (JPEG) | |
def to_image(path): | |
images = convert_from_path(path) | |
for i in range(len(images)): | |
images[i].save(path + 'page'+ str(i) +'.jpg', 'JPEG') | |
# Run | |
path = "" # Enter path | |
to_image(path) # Run function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment