Created
April 6, 2017 15:21
-
-
Save RobinDavid/2c376bcfa6bebd74f37d2492b8cb218a to your computer and use it in GitHub Desktop.
Create a pdf from a set of jpg images
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 fpdf import FPDF | |
from path import Path | |
import sys | |
imagelist = [x for x in sorted(Path(sys.argv[1]).listdir()) if x.ext == ".jpg"] | |
pdf = FPDF() | |
for im in imagelist: | |
pdf.add_page(orientation="P", format=(410,550)) #Size of images is known | |
pdf.image(im, 0, 0, 410, 550) | |
pdf.output("output.pdf","F") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment