A Python project for merging multiple images into a single PDF file. This tool is designed to simplify the process of consolidating images into a single, compact file format.
- Merge multiple images (JPEG, PNG, etc.) into a single PDF.
- Supports basic image resizing to fit within the PDF pages.
- Easy-to-use modular structure.
-
Python 3.8+
-
Install dependencies using:
pip install -r requirements.txt
To use this project, follow these steps:
-
Clone the Repository
Clone this repository to your local machine:
git clone https://github.com/m-ah07/Merge-Images-to-PDF-python.git cd Merge-Images-to-PDF-python
-
Create a Virtual Environment (Optional)
It is recommended to use a virtual environment for Python projects:
python -m venv venv source venv/bin/activate # On macOS/Linux venv\Scripts\activate # On Windows
-
Install Dependencies
Install the required Python libraries using pip:
pip install -r requirements.txt
-
Run Examples
Test the functionality by running the example script:
python examples/example.py
Ensure the file
requirements.txt
contains the dependencies:fpdf
pillow
from src.merge_images_to_pdf import merge_images_to_pdf
images = ["image1.jpg", "image2.png", "image3.jpeg"]
output_path = "output.pdf"
merge_images_to_pdf(images, output_path)
print(f"PDF saved at {output_path}")
Merge-Images-to-PDF-python/
βββ examples/
β βββ example.py
βββ src/
β βββ merge_images_to_pdf.py
βββ LICENSE
βββ README.md
βββ .gitignore
Feel free to fork this repository and submit pull requests to enhance functionality or add features.
If you found this project helpful, please consider giving it a β on GitHub. Your support means the world to us!