Skip to content

imgcompress is a lightweight, Dockerized image compression tool that converts HEIC from (iPhone Photos) and other photo formats to optimized JPEGs, resizes images for various use cases, and integrates seamlessly into CI/CD pipelines via a modern Web UI or CLI.

License

Notifications You must be signed in to change notification settings

karimz1/imgcompress

Repository files navigation

imgcompress: The Ultimate Docker Image Compression Tool

Docker Pulls
Docker Image Version
Docker Image Size
Build and Test Docker Image


🎬 See It In Action

Experience the power of imgcompress with the NEW modern Web UI. Check out the quick demo below:

Web UI in Action


❓Why imgcompress?

Ever been frustrated by juggling multiple programs just to convert or compress images? I did too.
I'm Karim Zouine and I built imgcompress as a one-stop solution to effortlessly compress, convert, and resize your images—all inside a Docker container. No more complicated installations or worrying about privacy with online converters. Everything runs locally, secure and consistent across any system.

and this is how the tool was born 🐣

imgcompress Mascot Logo

imgcompress Mascot

📰 Latest News

Stay up-to-date with the newest improvements:

For more details, check out the linked GitHub issues and pull requests!


Feature Overview

  • 📱 Convert iPhone HEIC Photos to JPEG:
    Easily convert your iPhone's HEIC images to JPEG for smaller file sizes and universal compatibility.

  • 🖼️ Universal Format Conversion & Resizing:
    Transform almost any photo format to JPEG and resize images effortlessly—ideal for creating thumbnails, web-optimized images, or custom sizes.

  • ⚙️ Customizable Output Quality:
    Fine-tune the compression settings to balance image clarity and file size, ensuring your photos look great while saving space.

  • 🗂️ Batch & Single File Processing:
    Whether you're processing one photo or an entire folder, imgcompress handles it all with ease.

  • 🔄 Seamless Automation & Flexible Logging:
    Integrate imgcompress into your CI/CD pipelines and choose between human-readable logs or structured JSON for a smoother workflow.


💰 Support Further Development

If you find imgcompress valuable, please consider supporting the project (entirely optional). Your contributions help fund the infrastructure and development tools needed to build even better open source software during my free time. Thank you for your support!

Donate using PayPal

🤗 My PayPal Email: [email protected]

paypal donate qr-code


🚀 Get Started in Seconds

Step 1: Install via Docker

Pull the latest image:

docker pull karimz1/imgcompress:latest

Step 2: Choose Your Workflow

A. Try the NEW Web User Interface (Highly Recommended!)

  1. Launch the Web UI:

    docker run --rm -p 5000:5000 karimz1/imgcompress:latest web
  2. Access the Web UI:

    Open your browser and go to: http://localhost:5000

  3. Explore the Features:

    • Drag & Drop Uploads: Simply drag your images into the browser.
    • Batch Processing: Compress multiple images simultaneously.
    • Real-Time Progress: Watch your images optimize live.
    • Download Instantly: Retrieve your optimized images directly from the browser.
    • Customizable Settings: Tweak quality and resize options effortlessly.

B. Use the Command-Line Interface (CLI) for Advanced Workflows

Single File Processing:

docker run --rm \
  -v "$(pwd):/container/images" \
  -v "$(pwd)/converted:/container/converted" \
  karimz1/imgcompress:latest \
  /container/images/example.jpg /container/converted --quality 80 --width 1920

Folder Processing:

docker run --rm \
  -v "$(pwd):/container/images" \
  -v "$(pwd)/converted:/container/converted" \
  karimz1/imgcompress:latest \
  /container/images /container/converted --quality 85 --width 800

How It Works

  1. 📁 Local Directory Mapping:

    Map your host machine’s directories into the Docker container:

    • Input: Your original images.
    • Output: Your optimized images.
  2. ⚙️ Process Parameters:

    Customize your conversion with:

    • --quality: Set JPEG quality (1–100, default: 85).
    • --width: Resize images to a desired width (optional).
    • --debug: Enable detailed logging.
    • --json-output: Generate logs in JSON format for automation workflows.

Detailed Example Logs

Text Output:

Starting image conversion process.
Processing directory: /container/input_folder/
Converted: /container/input_folder/photo1.jpg -> /container/output_folder/photo1.jpg (Q=80, W=800)
Converted: /container/input_folder/photo2.png -> /container/output_folder/photo2.jpg (Q=80, W=800)
Summary: 2 files processed, 0 errors.

JSON Output:

{
    "status": "complete",
    "conversion_results": {
        "files": [
            {
                "file": "photo1.jpg",
                "source": "/container/input_folder/photo1.jpg",
                "destination": "/container/output_folder/photo1.jpg",
                "original_width": 3648,
                "resized_width": 800,
                "is_successful": true,
                "error": null
            },
            {
                "file": "photo2.png",
                "source": "/container/input_folder/photo2.png",
                "destination": "/container/output_folder/photo2.jpg",
                "original_width": 6000,
                "resized_width": 800,
                "is_successful": true,
                "error": null
            }
        ],
        "file_processing_summary": {
            "total_files_count": 2,
            "successful_files_count": 2,
            "failed_files_count": 0
        }
    }
}

Advanced Use Cases

  • 🔧 CI/CD Integration: Use the --json-output flag to obtain structured results for automation, it acts as a mini API.

Need Help?

Display all available options:

docker run --rm karimz1/imgcompress --help

🔒 Privacy & Security

Your images remain private—no uploads to third-party servers. Everything runs locally in Docker, ensuring your data stays secure and under your control.


🤝 Contribute

Interested in contributing? Visit the Source Code on GitHub and feel free to fork, branch, and submit a pull request.


License

This project is licensed under the MIT License. See the LICENSE file for details.

About

imgcompress is a lightweight, Dockerized image compression tool that converts HEIC from (iPhone Photos) and other photo formats to optimized JPEGs, resizes images for various use cases, and integrates seamlessly into CI/CD pipelines via a modern Web UI or CLI.

Topics

Resources

License

Stars

Watchers

Forks