Created
January 22, 2021 16:45
-
-
Save rabbitix/e79b9e4c709f0b1c25009069591a9848 to your computer and use it in GitHub Desktop.
Convert a list of images to a pdf file
This file contains 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
from PIL import Image | |
import os | |
path = "" # path to dir of photos | |
files = os.listdir(path) | |
files = ["./{}/{}".format(path,file) for file in files] | |
im_list = [Image.open(file) for file in files ] | |
pdf1_filename = "./output.pdf" | |
im1 = im_list[0] | |
im1.save(pdf1_filename, "PDF" ,resolution=100.0, save_all=True, append_images=im_list) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment