ImgstoPdf
is a Python application that provides a simple graphical interface for searching and downloading images from an open-source photo database using an API. After fetching the images based on a user-defined keyword, the application converts the images into a single PDF file. The GUI also includes a loading bar to display the progress of the image download.
This repository contains the following components:
app.py
: The main graphical user interface (GUI) of the application, created using PyQt5. Users can input the number of images and the keyword for which they want to fetch photos. Upon clicking "Export to PDF," an API call is made to Unsplash to download the specified number of images. Once the images are successfully downloaded, they are converted into a PDF. The GUI also features a loading bar that updates based on the progress of the image download.
-
image_fetcher.py
: This Python script handles API calls to Unsplash to fetch images based on the provided keyword. It saves the downloaded images into a specified folder. -
pdf_converter.py
: This script takes the images from the specified folder stores them in an array data structure and combines them into a single PDF file. -
image_checker.py
: This utility script checks the types of images downloaded via API calls. It is useful for debugging and verifying the content of the downloaded images.
Make sure you have Python installed. You can install all required libraries using the requirements.txt
file provided in the repository.
-
Clone the repository:
git clone https://github.com/dheerajkallakuri/ImgstoPdf.git
-
Navigate to the project directory:
cd ImgstoPdf
-
Install the required libraries:
pip install -r requirements.txt
To run the application, execute the app.py
file:
python app.py
-
GUI Interaction:
- Open
app.py
to launch the GUI. - Enter the number of images and the keyword for the image search.
- Click "Export to PDF" to initiate the process.
- Open
-
Image Fetching:
app.py
callsimage_fetcher.py
to download images from Unsplash based on the provided keyword.- Images are saved in a folder named with the current timestamp.
-
PDF Conversion:
- After images are downloaded,
app.py
callspdf_converter.py
to convert these images into a PDF file.
- After images are downloaded,
-
Progress Tracking:
- The loading bar in the GUI updates as images are downloaded.
-
Debugging:
- Use
image_checker.py
to verify the types of images downloaded and ensure they meet your requirements.
- Use
app.py
: Main application GUI.image_fetcher.py
: Handles API calls and image saving.pdf_converter.py
: Converts images to PDF.image_checker.py
: Checks and debugs image types.