$0+

Image to PDF Conversion Python Script

1 rating
Add to cart

Image to PDF Conversion Python Script

$0+
1 rating

Image to PDF conversion script with support for additional image formats:

Description: This Python script converts all supported image files in a source folder into a single PDF document. It sorts the images alphabetically by filename before conversion.

Supported image formats are:

  • JPEG (.jpg, .jpeg)
  • PNG (.png)
  • BMP (.bmp)

Instructions:

  1. Install required Python modules:

<!---->

pip install pillow img2pdf

2. Add image files to convert to the "images" folder:

  • Place your JPEG, PNG, and BMP images in the "images" folder located in the same directory as the Python script
  1. Run the script:

<!---->

python create_pdf.py

4. The output PDF is created in the "pdfs" folder:

  • The PDF will be named "images.pdf"
  • Images are sorted alphabetically by filename in the PDF
  • PDF page size matches the original images
  1. Adjust source and destination folders:
  • Update the src_folder and dest_folder variables if you want to use different folder names
  • Folders will be created automatically if they don't exist

Usage Tips:

  • Works best with images of similar sizes/aspect ratios
  • Very large images may result in a large PDF file size
  • Supported image types can be adjusted by modifying the script
$
Add to cart
Size
2.99 KB

Ratings

5
(1 rating)
5 stars
100%
4 stars
0%
3 stars
0%
2 stars
0%
1 star
0%