Last active
August 29, 2015 14:15
-
-
Save map0logo/a40cf12dd9f858adfa62 to your computer and use it in GitHub Desktop.
Para crear el PDF a partir de las imágenes descargadas con https://gist.github.com/map0logo/d97911f3d7dae2d30804
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
# instalar img2pdf usando | |
# $ pip install img2pdf | |
import img2pdf | |
import glob | |
page_list = glob.glob("*.jpg") | |
def page_num(s): | |
start = s.index("-") + 1 | |
end = s.index(".", start + 1) | |
return s[start:end] | |
page_list.sort(key=page_num) | |
pdf_bytes = img2pdf.convert(page_list) | |
file = open("libro.pdf","wb") | |
file.write(pdf_bytes) | |
file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment