Created
October 16, 2022 16:59
-
-
Save bunnykek/08a1583eba0ee477a14febc54f212c77 to your computer and use it in GitHub Desktop.
Compiles all the images into a single pdf
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
#put this run.py file in the folder containing all the images. | |
from PIL import Image | |
import os | |
image_list = [] | |
files = os.listdir() | |
image_files = [] | |
for i in range(len(files)): | |
if files[i].endswith(".png"): #change the "png" according to the requirements. | |
image_files.append(files[i]) | |
for i in range(len(image_files)): | |
image = Image.open(image_files[i]).convert('RGB') | |
image_list.append(image) | |
if i == 0: | |
image_list.pop() | |
base_img = image | |
base_img.save('compiled.pdf', save_all=True, append_images=image_list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment