diff --git a/scripts/PNG_To_PDF/README.md b/scripts/PNG_To_PDF/README.md index c54e42b..02d1802 100644 --- a/scripts/PNG_To_PDF/README.md +++ b/scripts/PNG_To_PDF/README.md @@ -1,9 +1,9 @@ -This script consist of python code which converts PNG to PDF. +This script consist of python code which converts several PNG/JPG images to PDF. -It has a PNG image to use as example. For different image just write url of different image which you want to use/ replace "image.png" with total url of the image file. +It has several PNG/JPG images to use as examples. For different image just write url of different image which you want to use. If you want to increase or reduce the number of images you want to convert just add/subtract more lines for opening and converting, and add them to the list. Write the location of the PDF to be saved at/ replace 'document.pdf' with the total url and name of pdf along with pdf extension. I have used flake8 linting on this as well. -Dependency: Download python and write "pip install Pillow" in cmd. +Dependency: Download python and write "pip install Pillow" in cmd. \ No newline at end of file diff --git a/scripts/PNG_To_PDF/image1.jpg b/scripts/PNG_To_PDF/image1.jpg new file mode 100644 index 0000000..49ed415 Binary files /dev/null and b/scripts/PNG_To_PDF/image1.jpg differ diff --git a/scripts/PNG_To_PDF/image2.jpg b/scripts/PNG_To_PDF/image2.jpg new file mode 100644 index 0000000..57b7dce Binary files /dev/null and b/scripts/PNG_To_PDF/image2.jpg differ diff --git a/scripts/PNG_To_PDF/image3.jpeg b/scripts/PNG_To_PDF/image3.jpeg new file mode 100644 index 0000000..f2f6bfe Binary files /dev/null and b/scripts/PNG_To_PDF/image3.jpeg differ diff --git a/scripts/PNG_To_PDF/image4.jpg b/scripts/PNG_To_PDF/image4.jpg new file mode 100644 index 0000000..ece61d1 Binary files /dev/null and b/scripts/PNG_To_PDF/image4.jpg differ diff --git a/scripts/PNG_To_PDF/image5.png b/scripts/PNG_To_PDF/image5.png new file mode 100644 index 0000000..e79ce60 Binary files /dev/null and b/scripts/PNG_To_PDF/image5.png differ diff --git a/scripts/PNG_To_PDF/image6.png b/scripts/PNG_To_PDF/image6.png new file mode 100644 index 0000000..cbbbc49 Binary files /dev/null and b/scripts/PNG_To_PDF/image6.png differ diff --git a/scripts/PNG_To_PDF/img.png b/scripts/PNG_To_PDF/img.png deleted file mode 100644 index 4c74a66..0000000 Binary files a/scripts/PNG_To_PDF/img.png and /dev/null differ diff --git a/scripts/PNG_To_PDF/multipleIMGtoPDF.py b/scripts/PNG_To_PDF/multipleIMGtoPDF.py new file mode 100644 index 0000000..9da3c7f --- /dev/null +++ b/scripts/PNG_To_PDF/multipleIMGtoPDF.py @@ -0,0 +1,19 @@ +from PIL import Image + +img_1 = Image.open(r'image1.jpg') +img_2 = Image.open(r'image2.jpg') +img_3 = Image.open(r'image3.jpeg') +img_4 = Image.open(r'image4.jpg') +img_5 = Image.open(r'image5.png') +img_6 = Image.open(r'image6.png') + +im_1 = img_1.convert('RGB') +im_2 = img_2.convert('RGB') +im_3 = img_3.convert('RGB') +im_4 = img_4.convert('RGB') +im_5 = img_5.convert('RGB') +im_6 = img_6.convert('RGB') + +imlist = [im_2, im_3, im_4,im_5,im_6] + +im_1.save(r'listimg.pdf', save_all=True, append_images=imlist) \ No newline at end of file diff --git a/scripts/PNG_To_PDF/png-to-pdf.py b/scripts/PNG_To_PDF/png-to-pdf.py deleted file mode 100644 index 212b2f0..0000000 --- a/scripts/PNG_To_PDF/png-to-pdf.py +++ /dev/null @@ -1,5 +0,0 @@ -from PIL import Image - -image1 = Image.open(r'png-to-pdf.png') -impdf = image1.convert('RGB') -impdf.save(r'png-to-pdf.pdf') # noqa \ No newline at end of file