Skip to content

Commit b1a6929

Browse files
authored
Prepare release v0.3.1 merge (#441)
1 parent 7f94a3d commit b1a6929

28 files changed

+433
-196
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,5 @@ ENV PATH="/venv/bin:$PATH"
99
# Install Python dependencies
1010
COPY requirements-dev.txt .
1111
RUN pip install --upgrade pip && \
12-
pip install --no-cache-dir -r requirements-dev.txt
13-
14-
12+
pip install --no-cache-dir -r requirements-dev.txt
1513
ENTRYPOINT ["/bin/sh"]

.github/workflows/ci-auto-merge.yml

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ jobs:
4242
- name: Set up Docker Buildx
4343
uses: docker/setup-buildx-action@v3
4444

45-
- name: Build Docker image for ${{ matrix.platform }}
46-
run: |
47-
cd .devcontainer/
48-
docker buildx build \
49-
--platform ${{ matrix.platform }} \
50-
--load \
51-
-t devcontainer:local-test .
45+
- name: Build Dev Container for ${{ matrix.platform }}
46+
uses: docker/build-push-action@v6
47+
with:
48+
context: .devcontainer/
49+
platforms: ${{ matrix.platform }}
50+
load: true
51+
tags: devcontainer:local-test
52+
cache-from: type=gha,scope=devcontainer-${{ matrix.platform }}
53+
cache-to: type=gha,mode=max,scope=devcontainer-${{ matrix.platform }}
5254

5355
- name: Run Backend Unit Tests on ${{ matrix.platform }}
5456
run: |
@@ -94,14 +96,15 @@ jobs:
9496
- name: Set up Docker Buildx
9597
uses: docker/setup-buildx-action@v3
9698

97-
- name: Build Application Container Image for ${{ matrix.platform }}
98-
run: |
99-
docker buildx build \
100-
--platform ${{ matrix.platform }} \
101-
--load \
102-
--no-cache \
103-
-t karimz1/imgcompress:local-test \
104-
.
99+
- name: Build Application Container for ${{ matrix.platform }}
100+
uses: docker/build-push-action@v6
101+
with:
102+
context: .
103+
platforms: ${{ matrix.platform }}
104+
load: true
105+
tags: karimz1/imgcompress:local-test
106+
cache-from: type=gha,scope=app-${{ matrix.platform }}
107+
cache-to: type=gha,mode=max,scope=app-${{ matrix.platform }}
105108

106109
- name: Run Application Container (Host Networking) for ${{ matrix.platform }}
107110
run: |
@@ -128,15 +131,15 @@ jobs:
128131
done
129132
echo "Application is up! Continuing..."
130133
131-
- name: Build Dev Container Image for ${{ matrix.platform }}
132-
run: |
133-
cd .devcontainer/
134-
docker buildx build \
135-
--platform ${{ matrix.platform }} \
136-
--load \
137-
--no-cache \
138-
-t devcontainer:local-test \
139-
.
134+
- name: Build Dev Container for ${{ matrix.platform }}
135+
uses: docker/build-push-action@v6
136+
with:
137+
context: .devcontainer/
138+
platforms: ${{ matrix.platform }}
139+
load: true
140+
tags: devcontainer:local-test
141+
cache-from: type=gha,scope=devcontainer-${{ matrix.platform }}
142+
cache-to: type=gha,mode=max,scope=devcontainer-${{ matrix.platform }}
140143

141144
- name: Make E2E script executable
142145
run: chmod +x ./run-e2e.sh
@@ -184,6 +187,8 @@ jobs:
184187
- test-backend
185188
- test-e2e
186189
if: >
190+
github.event_name == 'pull_request' ||
191+
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
187192
(github.event_name == 'workflow_dispatch' && inputs.deploy_nightly == true) ||
188193
(github.event_name == 'issue_comment' &&
189194
github.event.issue.pull_request &&
@@ -201,7 +206,7 @@ jobs:
201206
-H "Accept: application/vnd.github+json" \
202207
-H "Authorization: token ${GH_TOKEN}" \
203208
https://api.github.com/repos/${{ github.repository }}/dispatches \
204-
-d '{"event_type": "deploy"}'
209+
-d "{\"event_type\": \"deploy\", \"client_payload\": {\"ref\": \"${{ github.head_ref || github.ref_name }}\"}}"
205210
206211
auto-merge-dependabot:
207212
needs:
@@ -233,4 +238,4 @@ jobs:
233238
-H "Accept: application/vnd.github+json" \
234239
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
235240
https://api.github.com/repos/${{ github.repository }}/dispatches \
236-
-d '{"event_type": "deploy"}'
241+
-d "{\"event_type\": \"deploy\", \"client_payload\": {\"ref\": \"${{ github.head_ref || github.ref_name }}\"}}"

.github/workflows/deploy.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
steps:
2020
- name: Check out repository
2121
uses: actions/checkout@v6
22+
with:
23+
ref: ${{ github.event.client_payload.ref || github.ref }}
2224

2325
- name: Login to Docker Hub
2426
uses: docker/login-action@v3
@@ -75,13 +77,31 @@ jobs:
7577
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
7678
printf 'tags=%s\n' "$(IFS=,; echo "${TAGS[*]}")" >> "$GITHUB_OUTPUT"
7779
80+
- name: Debug - Display Computed Tags
81+
shell: bash
82+
env:
83+
TAGS_OUTPUT: ${{ steps.tags.outputs.tags }}
84+
VERSION_OUTPUT: ${{ env.VERSION }}
85+
run: |
86+
echo "::group::🏷️ Computed Docker Image Tags"
87+
echo "VERSION: $VERSION_OUTPUT"
88+
echo ""
89+
echo "Tags that will be pushed:"
90+
IFS=',' read -ra TAG_ARRAY <<< "$TAGS_OUTPUT"
91+
for tag in "${TAG_ARRAY[@]}"; do
92+
echo " • $tag"
93+
done
94+
echo "::endgroup::"
95+
7896
- name: Build and Push Docker Image
7997
uses: docker/build-push-action@v6
8098
with:
8199
context: .
82100
platforms: linux/amd64,linux/arm64
83101
push: true
84102
tags: ${{ steps.tags.outputs.tags }}
103+
cache-from: type=gha,scope=app-deploy
104+
cache-to: type=gha,mode=max,scope=app-deploy
85105

86106
update-dockerhub-description:
87107
needs: deploy-image-to-dockerhub

Dockerfile

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,14 @@ FROM python:3.11-slim-bookworm
2525

2626

2727
# Metadata labels
28-
LABEL maintainer="Karim Zouine <mails.karimzouine@gmail.com>"
29-
LABEL version="1.0.0"
30-
LABEL description="imgcompress is a lightweight, efficient, and scalable image compression tool available as a Docker image. It compresses and optimizes images while maintaining high quality and supports HEIC-to-JPG conversion for seamless compatibility."
31-
32-
LABEL org.opencontainers.image.title="Image Compression Tool"
33-
LABEL org.opencontainers.image.description="A Dockerized tool for compressing and optimizing images with Python libraries. Features include batch processing, HEIC-to-JPG conversion, configurable quality settings, and automatic output directory creation."
28+
LABEL org.opencontainers.image.authors="Karim Zouine <mails.karimzouine@gmail.com>"
29+
LABEL org.opencontainers.image.vendor="Karim Zouine"
30+
LABEL org.opencontainers.image.title="imgcompress - High Performance Image Compression & Background Removal"
31+
LABEL org.opencontainers.image.description="Self-hosted, privacy-first tool for image compression, conversion (HEIC/WebP/PDF), and background removal using local AI. Supports 70+ formats."
3432
LABEL org.opencontainers.image.url="https://github.com/karimz1/imgcompress"
3533
LABEL org.opencontainers.image.source="https://github.com/karimz1/imgcompress"
3634
LABEL org.opencontainers.image.documentation="https://github.com/karimz1/imgcompress"
37-
LABEL org.opencontainers.image.licenses="MIT"
35+
LABEL org.opencontainers.image.licenses="GPL-3.0-or-later"
3836

3937
# 🧩 Install system dependencies required for full Pillow image format support
4038
#
@@ -60,16 +58,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
6058
# Set the working directory.
6159
WORKDIR /container
6260

63-
# Copy backend code, setup, and requirements.
64-
COPY backend/ /container/backend
65-
COPY setup.py /container/
61+
# Copy requirements and setup files first to leverage layer caching for dependencies
6662
COPY requirements.txt /container/
67-
COPY entrypoint.sh /container/entrypoint.sh
63+
COPY setup.py /container/
64+
RUN pip install --no-cache-dir -r requirements.txt
6865

66+
# Copy backend code and other necessary files
67+
COPY backend/ /container/backend
68+
COPY entrypoint.sh /container/entrypoint.sh
6969
RUN chmod +x /container/entrypoint.sh
7070

71-
# Install Python dependencies and your package.
72-
RUN pip install --no-cache-dir -r requirements.txt
71+
# Install the package itself (fast)
7372
RUN pip install --no-cache-dir .
7473

7574
# Pre-download rembg model so background removal doesn't fetch at runtime.

ReadMe.md

Lines changed: 83 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# imgcompress - Fast, Private Image Compression & Conversion Docker Image.
1+
# imgcompress - Privacy-First Image Optimizer: Compress, Convert & AI Background Removal (Docker)
22

33
[![Docker Pulls](https://img.shields.io/docker/pulls/karimz1/imgcompress)](https://hub.docker.com/r/karimz1/imgcompress)
44
[![Docker Image Size](https://img.shields.io/docker/image-size/karimz1/imgcompress/latest)](https://hub.docker.com/r/karimz1/imgcompress)
@@ -9,13 +9,17 @@
99

1010
<img src="images/logo_transparent.png" alt="imgcompress logo" width="490"/>
1111

12-
**imgcompress** is a fast, privacy-first image processing tool that runs entirely in Docker.
12+
**A self-hosted Docker image compression and conversion tool** with local AI background removal. Process unlimited images offline: no cloud uploads, no subscriptions, no per-image limits.
1313

14-
Compress, convert, resize, batch-process images and **remove backgrounds using local AI**
15-
with zero cloud dependencies.
14+
**Perfect for:** photographers managing large galleries, developers optimizing web assets, privacy-conscious users, and anyone needing a **free TinyPNG/Squoosh alternative** that runs entirely on your hardware.
1615

17-
With support for **70+ image formats**, a Web UI, and a powerful CLI,
18-
imgcompress is created for **self-hosted users** who want everything local full control, strong privacy, zero cloud uploads.
16+
### 🛡️ Why Choose imgcompress?
17+
18+
- **🔒 Privacy-First**: Your images never leave your network. Process sensitive documents, personal photos, and confidential materials with complete data sovereignty.
19+
- **💰 Unlimited Free Usage**: No subscriptions, API keys, or per-image credits. Compress millions of images at zero cost: a true alternative to expensive cloud services.
20+
- **🌐 Universal Format Support**: 70+ formats including HEIC, WebP, PSD, EPS, TIFF, and PDF ingestion. One tool for all your conversion needs.
21+
- **🏠 Self-Hosted Control**: Docker-based deployment for home labs, NAS devices, and enterprise environments. Full control over your image processing pipeline.
22+
- **🤖 Local AI Background Removal**: Remove backgrounds using on-device AI models. No external API calls, no data leakage.
1923

2024

2125

@@ -51,7 +55,7 @@ ___
5155
___
5256

5357

54-
- [imgcompress — Fast, Private Image Compression \& Conversion Docker Image.](#imgcompress--fast-private-image-compression--conversion-docker-image)
58+
- [imgcompress — Privacy-First Image Optimizer: Compress, Convert & AI Background Removal](#imgcompress---privacy-first-image-optimizer-compress-convert--ai-background-removal-docker)
5559
- [🚀 Quick Start](#-quick-start)
5660
- [Using `docker compose`](#using-docker-compose)
5761
- [Using `docker run`](#using-docker-run)
@@ -60,7 +64,8 @@ ___
6064
- [Using `docker compose`](#using-docker-compose-1)
6165
- [Using `docker run`](#using-docker-run-1)
6266
- [❓ Why imgcompress?](#-why-imgcompress)
63-
- [✨ Feature Overview](#-feature-overview)
67+
- [✨ Core Features](#-core-features)
68+
- [💼 Common Use Cases](#-common-use-cases)
6469
- [**🔖 Choosing Your Version**](#-choosing-your-version)
6570
- [**Stable (``latest``)**](#stable-latest)
6671
- [**Pinned Release (for example: `0.2.8`)**](#pinned-release-for-example-028)
@@ -149,36 +154,68 @@ ___
149154

150155
## ❓ Why imgcompress?
151156

152-
Ever been frustrated juggling multiple tools just to convert or compress images?
153-
**Me too**. I’m **Karim Zouine**, and I built imgcompress as a simple, unified tool for:
157+
Tired of **uploading sensitive images to cloud services**? Frustrated by **per-image pricing** on tools like TinyPNG? Need to **batch-process thousands of HEIC files** without expensive software?
154158

155-
- compression
156-
- conversion
157-
- resizing
158-
- batch processing
159+
**imgcompress solves this.** I'm **Karim Zouine**, and I built this as a **zero-cost, privacy-first alternative** to cloud-based image tools.
159160

160-
All locally, via Docker — for complete privacy.
161+
**What makes it different:**
162+
- **No cloud uploads**: Your images stay on your hardware. Critical for NDAs, medical imagery, or personal photos.
163+
- **No usage limits**: Process 10 images or 10 million. No subscriptions, no API quotas.
164+
- **All-in-one**: Compression, conversion (HEIC→JPG, PNG→WebP, PDF→images), resizing, and AI background removal in a single tool.
165+
- **Production-ready**: Multi-core processing, CLI automation, Docker isolation, and cross-platform support (ARM64/AMD64).
161166

162167
___
163168

164-
###Feature Overview
169+
## ✨ Core Features
165170

166-
📱 Instant HEIC → Anything: Convert HEIC/HEIF to JPG, PNG, ICO, and more.
171+
### 📱 HEIC/HEIF to JPG Converter
172+
Instantly convert Apple HEIC/HEIF images to JPG, PNG or any supported format. No more compatibility issues when sharing iPhone photos.
167173

168-
📰 PDF ingestion: Upload PDFs and automatically rasterize every page before compressing or converting.
174+
### 🤖 AI-Powered Background Removal
175+
Remove image backgrounds using local AI models (powered by rembg). Runs 100% offline: no API calls, no external services, complete privacy.
169176

170-
🖼️ Universal convert + resize: Supports HEIC, JPG, JPEG, PNG, PSD, TIFF, EPS, ICO, WebP, GIF, PDF and more.
177+
### 📰 PDF to Image Converter
178+
Upload multi-page PDFs and automatically extract/rasterize every page as individual images. Perfect for document processing workflows.
171179

172-
⚙️ Full control: Set JPEG quality, PNG lossless mode, target width, and more.
180+
### 🖼️ Universal Image Conversion
181+
Supports 70+ formats: HEIC, JPG, PNG, PSD, TIFF, EPS, ICO, WebP, GIF, BMP, and more. One tool for all conversion needs.
173182

174-
🚀 Multi-core batch processing: Automatically uses all CPU cores.
183+
### ⚙️ Granular Quality Control
184+
Set JPEG quality (1-100), enable PNG lossless mode, specify target dimensions, and fine-tune output settings.
175185

176-
🛠️ Automation-ready CLI: Perfect for scripts, CI/CD, cronjobs.
186+
### 🚀 Multi-Core Batch Processing
187+
Automatically utilizes all CPU cores for parallel processing. Compress thousands of images in minutes, not hours.
177188

178-
🔄 Machine-friendly logs: Use --json-output for automation & dashboards.
189+
### 🛠️ CLI Automation for CI/CD
190+
Scriptable command-line interface with `--json-output` for logs. Integrate into build pipelines, cronjobs, or automated workflows.
191+
192+
### 📦 Cross-Platform Docker Image
193+
Runs on Linux (x86-64, ARM64), macOS (Intel/Apple Silicon), Windows (WSL2), Raspberry Pi 4+, and AWS Graviton.
194+
195+
___
196+
197+
## 💼 Common Use Cases
198+
199+
### For Photographers
200+
- **Batch compress wedding photos**: Reduce file sizes by 70% without visible quality loss before client delivery.
201+
- **Convert RAW to Web formats**: Process thousands of images for portfolio websites or online galleries.
202+
- **HEIC compatibility**: Convert iPhone photos to JPG for universal client compatibility.
203+
204+
### For Developers
205+
- **Optimize web assets**: Compress images for faster page loads and better Core Web Vitals scores.
206+
- **CI/CD integration**: Automate image optimization in build pipelines using the CLI.
207+
- **Thumbnail generation**: Batch-resize product images for e-commerce platforms.
208+
209+
### For Privacy-Conscious Users
210+
- **Process sensitive documents**: Compress legal, medical, or confidential images without cloud uploads.
211+
- **Family photo management**: Organize and optimize personal galleries on your NAS or home server.
212+
- **Offline workflows**: Run completely air-gapped for maximum data security.
213+
214+
### For Enterprises
215+
- **GDPR/HIPAA compliance**: Keep image processing on-premises to meet regulatory requirements.
216+
- **Cost optimization**: Eliminate per-image fees from cloud services. Process unlimited images on your own infrastructure.
217+
- **Custom workflows**: Deploy on internal infrastructure with full control over processing logic.
179218

180-
📦 Runs everywhere: Linux, macOS, Windows (WSL2), ARM64, AMD64.
181-
182219
____
183220

184221
## **🔖 Choosing Your Version**
@@ -234,6 +271,19 @@ docker run --rm \
234271
cli \
235272
/container/images /container/converted --quality 85 --width 800
236273
```
274+
275+
**Background Removal (AI)**
276+
277+
``` bash
278+
docker run --rm \
279+
-v "$(pwd):/container/images" \
280+
-v "$(pwd)/converted:/container/converted" \
281+
karimz1/imgcompress:latest \
282+
cli \
283+
/container/images/photo.jpg /container/converted \
284+
--format png --remove-background
285+
```
286+
237287
**How it works**
238288

239289
1. **📁 Local directory mapping**
@@ -242,6 +292,8 @@ docker run --rm \
242292
2. **⚙️ Process parameters**
243293
- `--quality` (1–100, default 85)
244294
- `--width` (optional resize)
295+
- `--format` (jpeg or png, default jpeg)
296+
- `--remove-background` (AI background removal, requires `--format png`)
245297
- `--debug` (verbose logs)
246298
- `--json-output` (machine-friendly logs for CI)
247299

@@ -316,11 +368,11 @@ That means the images pass automated tests, but not every architecture has been
316368

317369
## 🔒 Privacy & Security
318370

319-
- **100 % local processing** — no uploads, no telemetry
320-
- **No telemetry, no tracking** — the container has zero outbound analytics.
371+
- **100% local processing**: No uploads, no telemetry.
372+
- **No telemetry, no tracking**: The container has zero outbound analytics.
321373
- **Open-source and auditable**
322374
- **Run fully offline**
323-
- **Docker isolation** — run with read-only volumes or network-disabled mode for extra peace of mind.
375+
- **Docker isolation**: Run with read-only volumes or network-disabled mode for extra peace of mind.
324376

325377
---
326378

@@ -329,7 +381,7 @@ That means the images pass automated tests, but not every architecture has been
329381
Want to make imgcompress even better?
330382

331383
1. ⭐ Star the repo to support the project
332-
2. **Fork → Branch → PR** — developers are welcome to contribute!
384+
2. **Fork → Branch → PR**: Developers are welcome to contribute!
333385
3. Browse `good first issue` or `help wanted` labels for starter tasks
334386
4. File bugs or feature requests on the [issue tracker](https://github.com/karimz1/imgcompress/issues)
335387

@@ -350,11 +402,11 @@ Every contribution helps support development, testing, and ongoing maintenance.
350402

351403
## 📓 Release Notes
352404

353-
See the full release history in [frontend/public/release-notes.md](https://github.com/karimz1/imgcompress/blob/main/frontend/public/release-notes.md).
405+
See the full release history in [frontend/public/release-notes.md](/frontend/public/release-notes.md).
354406

355407
## 📝 License
356408

357409
This project is licensed under the GNU General Public License v3.0 (GPL-3.0).
358-
See the [LICENSE](https://github.com/karimz1/imgcompress/blob/main/LICENSE) file for details.
410+
See the [LICENSE](/LICENSE) file for details.
359411

360412

0 commit comments

Comments
 (0)