We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4dd7667 commit be0dde8Copy full SHA for be0dde8
IMAGES & PHOTO SCRIPTS/Image to PDF/image2pdf.py
@@ -0,0 +1,31 @@
1
+ # importing necessary libraries
2
+import img2pdf
3
+from PIL import Image
4
+import os
5
+
6
+# storing image path
7
+img_path = "C:/Users/vedan/OneDrive/Desktop/image.png"
8
9
+# storing pdf path
10
+pdf_path = "C:/Users/vedan/OneDrive/Desktop/image.pdf"
11
12
+# opening image
13
+image = Image.open(img_path)
14
15
+# converting into chunks using img2pdf
16
+pdf_bytes = img2pdf.convert(image.filename)
17
18
+# opening or creating pdf file
19
+file = open(pdf_path, "wb")
20
21
+# writing pdf files with chunks
22
+file.write(pdf_bytes)
23
24
+# closing image file
25
+image.close()
26
27
+# closing pdf file
28
+file.close()
29
30
+# output
31
+print("Successfully made pdf file")
0 commit comments