Created
June 11, 2021 08:37
-
-
Save Proteusiq/aa6d169eccf40d9e09f41d86d8df68ec to your computer and use it in GitHub Desktop.
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
from pathlib import Path | |
from PIL import Image | |
# get all png images from folder `gotoslides` | |
SLIDES_IMAGES = Path("gotoslides").glob("*.png") | |
# maybe use a generator | convert RGB (since its png) | |
images = [Image.open(image).convert("RGB") for image in SLIDES_IMAGES] | |
with open("gotoslides.pdf", "wb") as pdf_file: | |
first_image, *rest_images = images | |
first_image.save( | |
pdf_file, "PDF", resolution=100, save_all=True, append_images=rest_images | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment