Skip to main content

ImageToPDF

A lightweight GUI application for converting images to PDF and PDF files to images. Built with PySide6, PyPDF2, and PyMuPDF.

Screenshot

Features

  • Image to PDF Conversion: Convert multiple images (JPEG, PNG) into a single merged PDF document
  • PDF to Image Conversion: Extract individual pages from PDF files as JPEG images
  • Batch Processing: Handle multiple images at once
  • Automatic Duplicate Handling: Prevents overwriting files with automatic naming
  • User-Friendly GUI: Intuitive interface with visual feedback
  • File Validation: Validates file types, sizes, and paths before processing
  • Logging System: Comprehensive logging for debugging and monitoring
  • Output Organization: All converted files are saved in a dedicated output folder
  • Error Handling: Robust error handling with user-friendly messages

Requirements

  • Python 3.6 or higher
  • PyMuPDF (fitz) - Required for PDF to JPEG conversion

Installation

1. Install Python Dependencies

pip install -r requirements.txt

2. Install PyMuPDF (Required for CLI tool)

pip install pymupdf

3. Run the Application

python ImageToPdf.py

Usage

GUI Application (ImageToPdf.py)

  1. Convert Images to PDF:

    • Click on any "Image 1-12" button to select image files
    • Selected images will be highlighted in green
    • Click "Convert Images To PDF" to merge all selected images into a single PDF
    • Output file will be saved as Merged_PDF_[timestamp].pdf in the output folder
  2. Convert PDF to JPEG:

    • Click "Convert PDF To JPEG" button
    • Select a PDF file
    • Each PDF page will be converted to a separate JPEG image
    • Output images will be saved in the output folder with naming format: Converted-PDF-page[number]_[timestamp].jpeg
  3. Clear Selection:

    • Click "Clear All Selection" to reset all selected images

Command Line Tool (Python_Lib.py)

Convert PDF files to JPEG images from the command line:

python Python_Lib.py /path/to/your/file.pdf

This will extract each page as a separate JPEG image in the output folder.

Project Structure

ImageToPDF/
├── ImageToPdf.py          # GUI Application
├── Python_Lib.py          # CLI Tool
├── constants.py           # Application constants
├── logger.py              # Logging configuration
├── utils.py               # Utility functions
├── requirements.txt       # Python dependencies
├── README.md              # This file
├── Screenshot.png         # Application screenshot
└── logs/                  # Log files (auto-created)
    └── image_to_pdf.log

Technology Stack

  • GUI Framework: PySide6
  • PDF Processing: PyPDF2, PyMuPDF (fitz)
  • Image Processing: Pillow (PIL)
  • Logging: Python logging module
  • CLI: argparse

Improvements

This version includes the following improvements over the original:

  • Security: Added file path validation and sanitization
  • Error Handling: Comprehensive error handling with user-friendly messages
  • Logging: Full logging system for debugging and monitoring
  • Code Quality: Type hints, docstrings, and consistent code style
  • Configuration: Centralized constants file for easy maintenance
  • Output Organization: Dedicated output folder for all converted files
  • File Size Limits: Maximum file size validation to prevent memory issues
  • Code Comments: Detailed comments explaining functionality
  • Type Safety: Type hints for better code clarity and IDE support
  • Modularity: Separated concerns into utility modules
  • Documentation: Improved README with project structure and usage examples

Notes

  • The application has been tested on Windows 10 and Windows 11
  • Both GUI (ImageToPdf.py) and command-line tool (Python_Lib.py) can be used independently
  • Converted files are saved in the output folder
  • Log files are saved in the logs folder
  • Last updated: 2026-02-08

License

This project is created by WAEL SAHLI.

Support

For issues or questions, please refer to the log files in the logs directory for detailed error information.

Metadata

Release files for imagetopdf-gui 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for imagetopdf-gui 2.0.0
File Size Uploaded
imagetopdf_gui-2.0.0.tar.gz 23.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for imagetopdf-gui 2.0.0
File Interpreter ABI Platform
imagetopdf_gui-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.7 kB

Release files / imagetopdf_gui-2.0.0.tar.gz

Download URL imagetopdf_gui-2.0.0.tar.gz
Size 23.8 kB
Tags Source
SHA-256 checksum
How to use checksums
df2460deb93ff21886a0ef3c01abfd785cbd51a8a34f586958f1556d34aeb8a7
BLAKE2b-256 checksum
How to use checksums
c292a6c25616712d7effad08c0941756974a8d418c50c271e76f33b8896195e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release files / imagetopdf_gui-2.0.0-py3-none-any.whl

Download URL imagetopdf_gui-2.0.0-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aed42ece0be6ca238b9f03e02495f4a1514a38e36babe19bcbc1c9436888760d
BLAKE2b-256 checksum
How to use checksums
e6d9f82b4e03b8da053b3f70194b89ee8e0258be554fb5236f82c69694ff16c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page