Skip to content

Instantly share code, notes, and snippets.

@alrafiabdullah
Created September 21, 2020 22:53
Show Gist options
  • Save alrafiabdullah/559367e4dcfd0995ef1c30d8a1bfee7e to your computer and use it in GitHub Desktop.
Save alrafiabdullah/559367e4dcfd0995ef1c30d8a1bfee7e to your computer and use it in GitHub Desktop.
Create PDF from Images (Except .png)
import img2pdf # run pip install img2pdf
img = "" # Local image file location
f = open('output.pdf', 'wb')
f.write(img2pdf.convert(img)) # Writes pdf file in the root directory
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment