Skip to content

Instantly share code, notes, and snippets.

@map0logo
Last active August 29, 2015 14:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save map0logo/a40cf12dd9f858adfa62 to your computer and use it in GitHub Desktop.
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
# 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