RepositoryPython
hauxir

hauxir/imgpush

Minimalist Self-hosted Image Service for user submitted images in your app

359stars
52forks
2issues
2views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: imagehost

#1 Repository of the month

1
TINIX TRENDING·Topic: picture

#1 Repository of the month

1
TINIX TRENDING·Topic: image-api

#1 Repository of the month

Screenshot 2019-06-19 at 17 56 29 Minimalist Self-hosted Image Service for user submitted images in your app (e.g. avatars).

Features

  • One simple API endpoint for uploading images
  • Automatic Conversion to an image format of your choice
  • Automatic resizing to any size of your liking
  • Built-in Rate limiting
  • Built-in Allowed Origin whitelisting
  • Liveness API
  • Delete API with API key authentication
  • Optional S3-compatible storage backend (AWS S3, Cloudflare R2, MinIO, etc.)

Usage

Uploading an image:

> curl -F 'file=@/some/file.jpg' http://some.host
{"filename":"somename.png"}

Uploading an image with authentication (when API_KEY and REQUIRE_API_KEY_FOR_UPLOAD are set):

> curl -F 'file=@/some/file.jpg' -H "Authorization: Bearer your-api-key" http://some.host
{"filename":"somename.png"}

Uploading an image by URL:

> curl -X POST -H "Content-Type: application/json" -d '{"url": "<SOME_URL>"}'  http://some.host

Fetching a file in a specific size(e.g. 320x240):

http://some.host/somename.png?w=320&h=240

returns the image cropped to the desired size

Deleting an image (requires API_KEY to be set):

> curl -X DELETE -H "Authorization: Bearer your-api-key" http://some.host/somename.png
{"status":"deleted","cached_files_removed":"3"}

This removes the original image and all cached resized versions.

Running

imgpush requires docker

docker run -v <PATH TO STORE IMAGES>:/images -p 5000:5000 hauxir/imgpush:latest

Kubernetes

This is fully optional and is only needed if you want to run imgpush in Kubernetes.

If you want to deploy imgpush in Kubernetes, there is an example deployment available in the Kubernetes directory. In case you do not have a running Kubernetes cluster yet, you can use Minikube to setup a local single-node Kubernetes cluster. Otherwise you can just use your existing cluster.

  1. Verify that your cluster works:
$ kubectl get pods
# Should return without an error, maybe prints information about some deployed pods.
  1. Apply the kubernetes/deployment-example.yaml file:
$ kubectl apply -f kubernetes/deployment-example.yaml
namespace/imgpush created
deployment.apps/imgpush created
persistentvolumeclaim/imgpush created
service/imgpush created
  1. It will take a moment while your Kubernetes downloads the current imgpush image.
  2. Verify that the deployment was successful:
$ kubectl -n imgpush get deployments.
NAME      READY   UP-TO-DATE   AVAILABLE   AGE
imgpush   1/1     1            1           3m41s

$ kubectl -n imgpush get svc
NAME      TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)    AGE
imgpush   ClusterIP   10.10.10.41   <none>        5000/TCP   3m57s
  1. When the deployment is finished, the READY column should be 1/1.
  2. Afterwards you can forward the port to your local machine and upload an image via your webbrowser (visit http://127.0.0.1:5000/).
$ kubectl -n imgpush port-forward service/imgpush 5000
Forwarding from 127.0.0.1:5000 -> 5000
Handling connection for 5000
Handling connection for 5000
Handling connection for 5000
Handling connection for 5000
  1. To expose imgpush to the internet you need to configure an Ingress. The exact configuration depends on you cluster but you can find an example in the kubernetes/deployment-example.yaml file that you can adapt to your setup.

Liveness

imgpush provides the /liveness endpoint that always returns 200 OK that you can use for docker Healthcheck and kubernetes liveness probe.

For Docker, as curl is install in the image :

healthcheck:
    start_period: 0s
    test: ['CMD-SHELL', 'curl localhost:5000/liveness -s -f -o /dev/null || exit 1']
    interval: 30s

For Kubernetes

livenessProbe:
    httpGet:
    path: /liveness
    port: 5000            
    initialDelaySeconds: 5
    periodSeconds: 30

Configuration

SettingDefault valueDescription
OUTPUT_TYPESame as Input fileAn image type supported by imagemagick, e.g. png or jpg
MAX_SIZE_MB"16"Integer, Max size per uploaded file in megabytes
MAX_UPLOADS_PER_DAY"1000"Integer, max per IP address
MAX_UPLOADS_PER_HOUR"100"Integer, max per IP address
MAX_UPLOADS_PER_MINUTE"20"Integer, max per IP address
ALLOWED_ORIGINS"['*']"array of domains, e.g ['https://a.com']
VALID_SIZESAny sizearray of integers allowed in the h= and w= parameters, e.g "[100,200,300]". You should set this to protect against being bombarded with requests!
NAME_STRATEGY"randomstr"randomstr for random 5 chars, uuidv4 for UUIDv4
NUDE_FILTER_MAX_THRESHOLDNonemax unsafe value returned from nudenet library(https://github.com/notAI-tech/NudeNet), range is from 0-0.99. Blocks nudity from being uploaded.
NUDE_FILTER_VIDEO_INTERVAL1.0Float, seconds between frame samples when checking videos for nudity. Only applies when ALLOW_VIDEO and NUDE_FILTER_MAX_THRESHOLD are both set.
MAX_VIDEO_DURATION60.0Float, maximum video duration in seconds. Videos exceeding this limit are rejected.
API_KEYNoneString, API key for authentication. Pass via Authorization: Bearer <key> header.
REQUIRE_API_KEY_FOR_UPLOADFalseBoolean, require API key for uploads.
REQUIRE_API_KEY_FOR_DELETETrueBoolean, require API key for deletes. Delete is disabled if API_KEY is not set.
MAX_API_KEY_ATTEMPTS_PER_MINUTE5Integer, max failed API key attempts per IP per minute.
STORAGE_BACKEND"local"Storage backend, local or s3. See S3 Storage.
S3_ENDPOINT_URL""S3 endpoint URL. Leave empty for AWS S3, set to your provider's URL for R2/MinIO/etc.
S3_ACCESS_KEY_ID""S3 access key ID.
S3_SECRET_ACCESS_KEY""S3 secret access key.
S3_BUCKET_NAME""S3 bucket name.
S3_REGION""S3 region (required for AWS S3; optional for some providers).
S3_IMAGES_PREFIX"images/"Key prefix for stored original images.
S3_CACHE_PREFIX"cache/"Key prefix for resized image cache.
LOCAL_CACHE_DIR"/local_cache/"Local disk path used to cache S3 objects for serving.
LOCAL_CACHE_MAX_SIZE_MB2048Integer, max size of the local S3 cache in megabytes.

Setting configuration variables is all set through env variables that get passed to the docker container.

Example:

docker run -e ALLOWED_ORIGINS="['https://a.com', 'https://b.com']" -s -v <PATH TO STORE IMAGES>:/images -p 5000:5000 hauxir/imgpush:latest

or to quickly deploy it locally, run

docker-compose up -d

S3 Storage

By default, imgpush stores images on the local filesystem under /images. You can instead store images in any S3-compatible object storage (AWS S3, Cloudflare R2, MinIO, Backblaze B2, etc.) by setting STORAGE_BACKEND=s3 along with the S3_* variables in the Configuration table.

When the S3 backend is active, originals are uploaded to S3_BUCKET_NAME under S3_IMAGES_PREFIX, and resized variants are cached both in S3 (under S3_CACHE_PREFIX) and on a local disk cache at LOCAL_CACHE_DIR to preserve fast serving via nginx X-Accel-Redirect. The local cache is bounded by LOCAL_CACHE_MAX_SIZE_MB and evicts least-recently-used entries.

Example docker run with Cloudflare R2:

docker run \
  -e STORAGE_BACKEND=s3 \
  -e S3_ENDPOINT_URL="https://<account-id>.r2.cloudflarestorage.com" \
  -e S3_ACCESS_KEY_ID="..." \
  -e S3_SECRET_ACCESS_KEY="..." \
  -e S3_BUCKET_NAME="my-bucket" \
  -v <PATH FOR LOCAL CACHE>:/local_cache \
  -p 5000:5000 hauxir/imgpush:latest

Migrating existing images to S3

To copy images from an existing local deployment into S3, use the provided migration script:

S3_ENDPOINT_URL=... S3_ACCESS_KEY_ID=... S3_SECRET_ACCESS_KEY=... \
S3_BUCKET_NAME=... S3_REGION=... \
python scripts/migrate_to_s3.py --images-dir /images

Pass --dry-run to preview, or --verify to check that uploaded objects exist.

Similar Projects

Discover other similar projects and AI models.

RepositoryPHP
HaschekSolutions/pictshare

:camera: PictShare is an open source image, mp4, pastebin hosting service with a simple resizing and upload API that you can host yourself. :rice_scene:

954
Nov 14, 2026
RepositoryPython
bregman-arie/devops-exercises

Linux, Jenkins, AWS, SRE, Prometheus, Docker, Python, Ansible, Git, Kubernetes, Terraform, OpenStack, SQL, NoSQL, Azure, GCP, DNS, Elastic, Network, Virtualization. DevOps Interview Questions

87.1k
Dec 27, 2025
RepositoryJavaScript
louislam/uptime-kuma

A fancy self-hosted monitoring tool

95.1k
Nov 30, 2026
RepositoryGo
netdata/netdata

Full-stack observability · Metrics · Logs · Traces · Flows · Topology · Infrastructure · APM · NPM · DBM · RUM · Synthetics · Cloud · AI SRE · OpenTelemetry · SNMP · NetFlow/IPFIX/sFlow · IPMI · Redfish · 2000+ integrations

81.7k
Nov 30, 2026
RepositoryGo
traefik/traefik

The Cloud Native Application Proxy

65.9k
Dec 2, 2026
RepositoryTypeScript
appwrite/appwrite

The open-source cloud for agents & devs. Including Auth, Databases, Storage, Functions, Messaging, Hosting, Realtime, WAF and more

58.8k
Dec 2, 2026
RepositoryGo
aquasecurity/trivy

Find vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more

39.9k
Dec 1, 2026
RepositoryGo
podman-container-tools/podman

Podman: A tool for managing OCI containers and pods.

33.4k
Dec 1, 2026
RepositoryGo
dokku/dokku

A docker-powered PaaS that helps you build and manage the lifecycle of applications

32.2k
Nov 30, 2026