Skip to content

daghlar/converter

Repository files navigation

Image to PDF Converter

An advanced web application that converts uploaded image files to a single PDF document with professional features and format support.

Features

  • Upload multiple image files at once
  • Support for 10+ image formats: PNG, JPG, JPEG, BMP, TIFF, WEBP, GIF, ICO, TGA, PSD
  • Drag and drop interface
  • Real-time file preview with format-specific icons
  • Advanced PDF settings (Quality, DPI, Optimization)
  • Automatic format detection and correction
  • Transparent image support (RGBA to RGB conversion)
  • Image optimization and compression
  • Responsive design
  • File size validation (max 16MB per file)
  • Maximum 20 files per conversion

Technologies Used

  • Backend: Python 3.12+ with built-in HTTP server
  • PDF Conversion: Pillow (PIL) library
  • Frontend: HTML5, CSS3, JavaScript
  • Image Processing: Pillow (PIL)

Installation

  1. Clone the repository:
git clone <repository-url> cd pngpdfconvert
  1. Install Python dependencies:
# For standalone version (minimal dependencies) pip install Pillow # For Flask version (full features) pip install -r requirements.txt
  1. Run the application:
# Standalone version (recommended) python3 standalone_converter.py # Flask version (requires additional setup) python3 app.py
  1. Open your browser and navigate to:
    • Standalone: http://localhost:9000
    • Flask: http://localhost:5000

Usage

  1. Open the web application in your browser
  2. Drag and drop image files onto the upload area or click to select files
  3. Review the uploaded files in the file list
  4. (Optional) Click "Settings" to adjust PDF quality, DPI, and optimization
  5. Click "Convert to PDF" to generate the PDF
  6. The PDF will be automatically downloaded

Advanced Settings

  • Quality: Adjust PDF compression (10-100%)
  • DPI: Set resolution for print quality (72, 150, 300 DPI)
  • Optimization: Enable file size optimization
  • Format Detection: Automatic format correction for files without extensions

Format-Specific Processing

Each image format is processed with specialized algorithms:

  • PNG: Transparency handling, palette conversion, quality preservation
  • JPEG: Compression optimization, quality control
  • BMP: Lossless to optimized conversion
  • TIFF: Multi-page support, high-quality processing
  • WEBP: Modern format optimization
  • GIF: Animation handling, transparency support
  • ICO: Multi-size icon processing
  • TGA: Transparency and color space handling
  • PSD: Layer flattening, transparency support

File Structure

pngpdfconvert/ ├── standalone_converter.py # Main Python application (recommended) ├── app.py # Flask version (optional) ├── simple_converter.html # Client-side only version ├── requirements.txt # Python dependencies ├── templates/ │ └── index.html # Flask HTML template └── static/ ├── css/ │ └── style.css # CSS styles └── js/ └── script.js # JavaScript functionality 

Requirements

  • Python 3.7+
  • Pillow (PIL) library

Deployment

This application can be easily deployed to platforms like:

  • Heroku
  • Render
  • PythonAnywhere
  • DigitalOcean App Platform

For production deployment, consider using the Flask version (app.py) with proper WSGI server.

Alternative Versions

  1. Standalone Version (standalone_converter.py): Uses Python's built-in HTTP server, no external dependencies except Pillow
  2. Flask Version (app.py): Full Flask application with img2pdf library
  3. Client-Side Version (simple_converter.html): HTML-only version (limited functionality)

License

This project is open source and available under the MIT License.

About

Converter Pdf Png Jpg Jpeg

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published