Every site that serves images eventually runs into the same wall. Someone uploads a 12 megapixel phone photo, and you need it at 1200 pixels for the hero, 600 for a card, 200 for a thumbnail grid, and 48 for an avatar. The old answer is to pre-generate every size on upload, which means a cron job, a folder full of derived files, and a rebuild every time you change a layout. The newer answer is a SaaS image CDN that resizes on the fly — and charges you per transformation, per month, forever, while your originals sit on someone else’s storage.
Serving images in 2026 feels like wrestling an octopus. Every format is another tentacle reaching for the same picture: JPEG and PNG are the two arms you have always had, WebP and AVIF each want their own copy of every image at every size, and now JPEG XL is joining the format lineup as well. Pre-generate a file for every tentacle and your media directory turns into a maintenance job with a growing file count. Skip one and part of your audience gets the wrong file, or a file their browser quietly refuses to render.
The way out of that tangle is to stop pre-generating anything. imagor is a fast, secure image processing server that runs as a single Docker container. It takes an image URL, applies whatever resize, crop, filter or format conversion you describe in the path, and returns the result. It is built in Go on top of libvips, speaks the same URL syntax as thumbor, and needs no database, no queue and no second service to function.
This article walks through a practical self-hosted deployment: a copy-paste Docker Compose stack for development and a hardened one for production, the complete URL syntax so you can actually use the thing, the environment variables that matter and the ones you can ignore, the file system and S3 storage backends, the URL signing model that keeps a public instance from being abused, and the caching layers that make it fast. By the end you should be able to stand up an image server that replaces a paid image CDN for the cost of a small VPS.
I run this setup myself. imagor sits in front of my own storage and auto-optimises images for my sites and for customer projects — the same job that tools like Optimole or ShortPixel do, minus the CDN and the subscription. Everything below is the configuration I actually run, security settings included, because a public image endpoint that anyone can hammer is not a theoretical problem.
Why Run Your Own Image Server?
Before the how, here is the honest case for keeping image processing on your own hardware.
- You stop pre-generating sizes — one original, infinite derived sizes, generated on first request and cached after that. Change your design, change the URL, done.
- Per-transform pricing goes away — commercial image CDNs bill by transformation count or by delivered gigabytes. A self-hosted server bills you in CPU and bandwidth you already pay for.
- Your images stay yours — originals never leave your storage, and no third party gets a view of your traffic patterns or your catalogue.
- No vendor lock-in in your markup — imagor uses thumbor’s URL syntax, so the URLs you generate are a de facto standard rather than a proprietary API.
- It is genuinely fast — libvips is the same library behind many commercial services, and imagor’s streamed request path keeps it close to the metal.
- It fits in your existing stack — one container, one port, a volume or an S3 bucket. No Redis to babysit, no Postgres schema to migrate.
What imagor Actually Does
imagor is a stateless HTTP service with a very small surface area: a URL goes in, an image comes out. Everything else is configuration.
- On-the-fly resizing and cropping — resize to exact dimensions, fit inside a box, fill a box with smart focal-point cropping, or crop manually with pixel or percentage coordinates.
- A full filter pipeline — blur, sharpen, brightness, contrast, saturation, hue, rotate, grayscale, invert, pixelate, round corners, text overlays, watermarks, and format conversion, all chainable in one URL.
- Modern formats — output as JPEG, PNG, GIF, WebP, AVIF, JPEG XL, TIFF or JPEG 2000, with automatic WebP/AVIF/JPEG negotiation based on the browser’s Accept header.
- Multiple source backends — remote HTTP/HTTPS URLs, a local mounted directory, AWS S3 or any S3-compatible service such as Cloudflare R2, MinIO and DigitalOcean Spaces, or Google Cloud Storage.
- Result caching — processed images can be written to file system or object storage, so the second request for the same transformation is a static file read rather than a re-encode.
- An in-memory pixel cache — decodes a source image once and reuses the pixels across requests, which is a big win when the same watermark or base image appears everywhere.
- URL signing — HMAC-signed URLs with optional expiry, so only your application can ask for transformations, and a public endpoint cannot be used as free CPU.
- Metadata and EXIF — a
/metaendpoint returns format, dimensions, orientation, page count, bands and EXIF as JSON, plus BlurHash, ThumbHash and average colour placeholders. - Image bomb protection — hard limits on width, height, total resolution and animation frames, plus request, load and processing timeouts and a concurrency cap.
- Prometheus metrics — an optional metrics endpoint with a configurable path and namespace, and optional Sentry error reporting.
- Zero external state — no database, no message queue, no shared cache server. Scale it horizontally by running more containers.
The Essentials at a Glance
Here is the whole map before we dig into the details. Nothing here is mandatory except the secret in production — everything else is opt-in.
| Piece | What it is | When you need it |
|---|---|---|
The container | shumc/imagor on port 8000 | Always — this is the server |
HTTP Loader | Fetches images from remote URLs | Enabled by default, useful for testing and public sources |
File system loader | Reads images from a mounted directory | Your own image library lives on the same host |
S3 loader | Reads images from S3 or S3-compatible storage | Object storage is your source of truth |
Result storage | Writes processed images to disk or a bucket | You want cache hits instead of repeat processing |
In-memory cache | Keeps decoded pixels in RAM | Same source image requested at many sizes |
IMAGOR_SECRET | HMAC key for URL signatures | Any instance reachable from the internet |
VIPS limits | Max width, height, resolution, frames | Any instance that accepts untrusted image sources |
Prometheus endpoint | Metrics on a separate port | You want to watch it alongside everything else |
A Little Background
imagor is built and maintained by Adrian C. Shum, with the first commit landing in May 2021. It is written in Go, released under the Apache 2.0 license, and lives at cshum/imagor on GitHub, where it has passed 4,000 stars and 175 forks. What makes it interesting is not the star count but the commit history: the project is actively maintained, with the current release, v1.9.10, published on 14 October 2026, and only a couple of open issues against a codebase of more than 1,700 commits.
The technical decision that defines everything else is libvips. Instead of shelling out to ImageMagick or reimplementing resampling in pure Go, imagor binds directly to libvips through vipsgen, a generated, type-safe binding that supports streaming. The official README claims it is typically 4 to 8 times faster than the quickest ImageMagick settings, and the project publishes its benchmark methodology so you can check the claim yourself.
The other defining decision is URL compatibility. imagor adopts thumbor’s URL syntax rather than inventing its own, which makes it a drop-in replacement for an existing thumbor deployment and means the URLs you generate are portable. If you have ever written a thumbor URL, you already know most of imagor.
The Docker image is worth a mention on its own. It is roughly 109 MB, based on a purpose-built image carrying libvips 8.18.7 and built with Go 1.27.2, and it preloads jemalloc for better memory behaviour under concurrent load. It sets VIPS_WARNING=0, MALLOC_ARENA_MAX=2 and VIPS_VECTOR=167772160 for you, exposes port 8000, and runs as the nobody user by default. You do not have to install libvips on your host, and you do not have to think about any of this unless you want to.
Around the core server sits a small ecosystem: imagorvideo adds video thumbnail generation through ffmpeg C bindings, imagorface adds face detection so smart crop can anchor on faces, and Imagor Studio is a hosted playground for building and testing URLs visually. All three are optional; the base container does not need them.
How Fast Is It, Really?
The project maintains a public benchmark suite and published a rerun in May 2026. The setup was an AWS EC2 c7i.large instance, 2 virtual users, a five minute run with a ten second warmup, and a 512×512 resize workload. Three servers were compared: imagor 1.9.1, imgproxy v4.0.3 and thumbor 7.7.7.
| Format | imagor | imgproxy | thumbor |
|---|---|---|---|
JPEG | 74.35 req/s | 82.01 req/s | 59.45 req/s |
PNG | 18.56 req/s | 17.35 req/s | 10.23 req/s |
WebP | 21.23 req/s | 24.27 req/s | 15.80 req/s |
AVIF | 17.77 req/s | 17.15 req/s | 14.85 req/s |
Read that honestly. imagor beats thumbor on every format, and it trades wins with imgproxy — ahead on PNG and AVIF, behind on JPEG and WebP. Since both are libvips-based, the difference comes down to request-path overhead and encoder defaults rather than the image library itself. If you are migrating from thumbor, expect a solid speedup. If you are choosing between imagor and imgproxy, pick on the feature set and the licensing you prefer, not on a few requests per second.
The URL Syntax in Five Minutes
Everything imagor does is expressed in the URL path. The full grammar looks intimidating, but almost all of it is optional and you will use a handful of pieces in practice. Here is the complete shape:
|
1 |
/HASH|unsafe/trim/AxB:CxD/(adaptive-)(full-)fit-in/stretch/-Ex-F/GxH:IxJ/HALIGN/VALIGN/smart/filters:NAME(ARGS):NAME(ARGS):.../IMAGE |
Two rules explain most of the confusion people hit. First, every segment is optional, so /unsafe/400x400/photo.jpg is a complete, valid request. Second, filters must be the last thing before the image path — imagor reads everything after filters: as the image itself, so a resize written after a filter becomes part of the filename and the load fails.
Resize and Crop
The simplest form is WxH, which resizes the image and centre-crops the excess to fill that exact box. Set either dimension to 0 to preserve the aspect ratio on that axis.
|
1 2 3 |
/unsafe/400x400/photo.jpg resize to 400x400, centre-crop to fill /unsafe/400x0/photo.jpg resize to width 400, height proportional /unsafe/0x400/photo.jpg resize to height 400, width proportional |
For a manual crop, give the top-left and bottom-right corners as AxB:CxD before the resize. Coordinates can be integers in pixels or floats between 0 and 1 as a percentage of the image dimensions.
|
1 2 |
/unsafe/100x50:1800x1200/400x400/photo.jpg crop a region, then resize /unsafe/0.1x0.1:0.9x0.9/photo.jpg crop the inner 80% |
Prefixing a dimension with a minus sign flips that axis instead of cropping, which is a neat trick for mirroring avatars.
|
1 2 3 |
/unsafe/-400x400/photo.jpg flip horizontally /unsafe/400x-400/photo.jpg flip vertically /unsafe/-400x-400/photo.jpg flip both |
Alignment and Smart Crop
When imagor crops, it centres by default. You can move the crop window with a horizontal alignment of left, center or right, and a vertical alignment of top, middle or bottom. That is essential for portraits, where the interesting part is almost never the middle of the frame.
|
1 2 |
/unsafe/400x400/left/top/photo.jpg /unsafe/400x400/right/bottom/photo.jpg |
Better still, add smart and let imagor find the focal point itself. This is the single most useful feature in the whole URL syntax: you can crop a 16:9 hero, a 1:1 avatar and a 4:3 card out of the same source photo and get a sensible result every time, without anyone manually picking crop coordinates.
|
1 2 |
/unsafe/400x400/smart/photo.jpg /unsafe/200x200/smart/filters:fill(white):format(jpeg):quality(80)/photo.jpg |
Fit-In, Full Fit-In and Adaptive Fit-In
Sometimes you do not want to crop at all. fit-in resizes the image so it fits inside the box without cutting anything off, which may leave letterboxed space. Pair it with the fill() filter to paint that space, and you get the classic padded product shot on a white or blurred background.
|
1 2 3 4 |
/unsafe/fit-in/400x400/photo.jpg /unsafe/fit-in/400x400/filters:fill(white)/photo.jpg /unsafe/fit-in/400x400/filters:fill(blur)/photo.jpg /unsafe/fit-in/400x400/filters:fill(auto)/photo.jpg |
fill(blur) extends the image with a blurred copy of itself, which looks far better than a flat colour for photographic content. fill(auto) samples the average colour of the image instead. Two variants exist for edge cases: full-fit-in uses the larger dimension for fitting so the image always fills at least one edge of the box, and adaptive-fit-in swaps width and height automatically when that produces better coverage.
Padding and Trim
Padding adds space around the image after resizing, written as two corner pairs after the dimensions: left and top, then right and bottom. It is most useful combined with fit-in and fill() to create a bordered frame.
|
1 |
/unsafe/fit-in/360x360/20x20:20x20/filters:fill(yellow)/photo.jpg |
trim does the opposite and removes surrounding whitespace, sampling a corner pixel as the background reference. It runs before any resize, so it changes what gets resized rather than the output dimensions. You can pick which corner to sample and how much colour variation still counts as background.
|
1 2 3 |
/unsafe/trim/400x400/photo.jpg sample the top-left pixel /unsafe/trim:bottom-right/400x400/photo.jpg sample the bottom-right pixel /unsafe/trim:bottom-right:100/400x400/photo.jpg with a tolerance of 100 |
Filters
Filters are a pipeline applied after the resize, written as filters:name(args):name(args). They chain left to right, so order matters. Here are the ones you will actually reach for:
- Colour and tone —
brightness(-100..100),contrast(-100..100),saturation(-100..100),hue(angle),grayscale(),invert(),rgb(r,g,b),to_colorspace(profile) - Sharpness and blur —
blur(sigma),sharpen(sigma),pixelate(block_size) - Geometry —
rotate(angle),orient(angle),crop(left,top,width,height),round_corner(rx,ry,color),proportion(percentage) - Output control —
format(jpeg|png|gif|webp|avif|jxl|tiff|jp2),quality(1..100),lossless(),max_bytes(amount),no_upscale(),upscale() - Overlays —
watermark(image,x,y,alpha,w_ratio,h_ratio),text(text,x,y,font,color,alpha,...),image(imagorpath,x,y,alpha,blend_mode) - Backgrounds and focal points —
background_color(color),fill(color|blur|auto|none),focal(AxB:CxD)orfocal(X,Y) - Metadata hygiene —
strip_exif(),strip_icc(),dpi(num),page(num)for PDFs and multi-page sources,max_frames(n)for animated GIFs - Pipeline utilities —
preview()to skip result storage and opt into the in-memory cache,raw()to return the untouched source,attachment(filename)to force a download,max_age(seconds)andexpire(timestamp)to control caching per response
The watermark and text filters are the ones that surprise people, because they mean you can do branding at the image server instead of in your application. A watermark can tile, and its position accepts the same alignment vocabulary as crop.
|
1 2 3 |
/unsafe/fit-in/200x150/filters:fill(yellow):watermark(logo.png,repeat,bottom,0,40,40)/photo.gif /unsafe/400x400/filters:grayscale():quality(80)/photo.jpg /unsafe/fit-in/400x400/filters:fill(blur):format(webp)/photo.jpg |
Pointing at Image Sources
The last segment of the URL is the image itself, and it accepts more forms than people expect. A plain path or URL works when the source is simple. If the URL contains a query string, encode it with encodeURIComponent so the ? does not collide with the URL’s own query handling. When a source is long or full of awkward characters, wrap it in the b64: prefix and imagor decodes it as base64url.
|
1 2 |
/unsafe/400x400/raw.githubusercontent.com/cshum/imagor/master/testdata/gopher.png /unsafe/400x400/b64:aHR0cHM6Ly9leGFtcGxlLmNvbS9pbWFnZS5qcGc_c2l6ZT1sYXJnZSZkb3dubG9hZD0x/ |
There is also a color: prefix that generates an image from nothing, which is genuinely handy for placeholder boxes and spacer graphics in a responsive layout. It accepts named colours, hex values with optional alpha, and none for transparency.
|
1 2 |
/unsafe/400x400/color:ff8800 /unsafe/400x400/color:none |
Docker Compose Setup
imagor is a single container with a single port. Start with the development stack: it uses unsafe mode, so any URL works without a signature, and it serves images from remote HTTP sources. This is the configuration for trying things out, not for anything reachable from the internet.
|
1 2 3 4 5 6 7 8 9 10 11 |
services: imagor: image: shumc/imagor:latest container_name: imagor restart: unless-stopped ports: - "8000:8000" environment: PORT: 8000 IMAGOR_UNSAFE: 1 IMAGOR_AUTO_WEBP: 1 |
Once that is running, this URL resizes an image from the project’s own test data and you can see it working immediately:
|
1 |
http://your-server-ip:8000/unsafe/fit-in/200x200/filters:fill(white)/https://raw.githubusercontent.com/cshum/imagor/master/testdata/gopher.png |
Now the production stack. Three things change: a secret replaces unsafe mode, the source of images is restricted to hosts you control, and the resource limits that protect against malicious input are switched on. Result storage on disk means the second request for the same transformation is a file read.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
services: imagor: image: shumc/imagor:1.9.10 container_name: imagor restart: unless-stopped ports: - "8000:8000" volumes: - ./data:/mnt/data environment: PORT: 8000 IMAGOR_SECRET: change-this-to-a-long-random-string IMAGOR_SIGNER_TYPE: sha256 IMAGOR_SIGNER_TRUNCATE: 40 IMAGOR_AUTO_WEBP: 1 IMAGOR_AUTO_AVIF: 1 HTTP_LOADER_ALLOWED_SOURCES: "*.mydomain.com,assets.cdn.io" HTTP_LOADER_HTTPS_ONLY: 1 VIPS_MAX_RESOLUTION: 16800000 VIPS_MAX_WIDTH: 5000 VIPS_MAX_HEIGHT: 5000 VIPS_MAX_ANIMATION_FRAMES: 100 IMAGOR_REQUEST_TIMEOUT: 30s IMAGOR_LOAD_TIMEOUT: 10s IMAGOR_PROCESS_CONCURRENCY: 20 IMAGOR_CACHE_HEADER_TTL: 168h FILE_RESULT_STORAGE_BASE_DIR: /mnt/data/result FILE_RESULT_STORAGE_EXPIRATION: 168h |
Two things worth pointing out about that file. The image tag is pinned to 1.9.10 rather than latest, so a routine restart cannot silently change your behaviour. And the file system volume is mounted at /mnt/data rather than /app/data because that is the path the documentation uses in its own examples — the container does not care, but consistency makes the docs and your compose file line up.
Security note: the IMAGOR_SECRET value above is a placeholder and belongs in a .env file that is not committed to version control. Anyone holding that string can generate valid URLs, which is the same as holding the keys to your CPU.
Installation Steps
- Create a project directory. Make a folder on your server and put the
docker-compose.ymlfrom above inside it. - Start the container.
- Confirm it is alive. Check the logs and then hit the port. imagor has no web interface, so a successful image response is the only “it works” signal you get.
- Run your first transformation. This resizes a test image to 400×400 with a white fill behind it, and writes the result to a local file so you can open it.
If
test.jpgis a resized gopher, the server works. If you get a blank file or an error, read the container logs before changing anything else. - Generate a secret. Do this before you expose the instance to anything. Any long random string works;
opensslis the easiest way to produce one. - Put the secret in a
.envfile next to your compose file, then reference it from the compose environment block asIMAGOR_SECRET: ${IMAGOR_SECRET}so the value never lives in version control. - Remove
IMAGOR_UNSAFEand restart. From this point every request must carry a valid signature, and/unsafe/paths stop working. That is the point. - Sign your first URL. The signature is an HMAC of the path — everything after the hash, without a leading slash — base64url encoded and prepended. This Python snippet produces one you can paste straight into a browser.
Note the algorithm: SHA1 is the default because that is what thumbor uses. If you set
IMAGOR_SIGNER_TYPE: sha256, swaphashlib.sha1forhashlib.sha256, and truncate the base64 result to matchIMAGOR_SIGNER_TRUNCATEif you set it. - Restrict where images can come from. Set
HTTP_LOADER_ALLOWED_SOURCESto the hosts you actually serve from, and turn onHTTP_LOADER_HTTPS_ONLY. Without this, a signed URL can still be pointed at any host on the internet. - Give it a real hostname. Put imagor behind whatever reverse proxy you already run, give it a name like
img.mydomain.com, and terminate TLS there. imagor speaks plain HTTP on port 8000 and is happy behind a proxy; the setup of the proxy itself is a separate topic and is not specific to imagor. - Watch it for a day. Enable the Prometheus endpoint on a second port, point your existing monitoring at it, and you will see the request rate, latency and concurrency before you have a problem rather than after.
Configuration and Environment Variables
imagor accepts configuration two ways: command-line flags and environment variables. They are the same settings, with the environment variable being the flag name in uppercase snake case. So -imagor-secret 1234 and IMAGOR_SECRET=1234 are exactly equivalent, and you can mix the two.
|
1 2 3 |
# these two are the same thing imagor -debug -imagor-secret 1234 DEBUG=1 IMAGOR_SECRET=1234 imagor |
You can also load configuration from a .env file with -config, which is a clean way to keep a long list of settings out of your compose file.
|
1 2 3 |
PORT=8000 IMAGOR_SECRET=mysecret DEBUG=1 |
To see every option the binary supports, run imagor -h inside the container. The tables below cover what you will realistically set.
Server and Runtime
| Variable | Default | What it does |
|---|---|---|
PORT | 8000 | The port the server listens on |
BIND | — | Combined address:port shortcut, overrides SERVER_ADDRESS and PORT |
SERVER_ADDRESS | all interfaces | Bind address only |
SERVER_CORS | off | Enable CORS headers |
SERVER_STRIP_QUERY_STRING | off | Redirect requests that carry a query string |
SERVER_PATH_PREFIX | — | Serve everything under a path prefix |
SERVER_ACCESS_LOG | off | Log every request |
GOMAXPROCS | all cores | Go runtime CPU limit |
DEBUG | off | Debug mode |
CONFIG | .env | Path to a configuration file to load |
Core Image Behaviour
| Variable | Default | What it does |
|---|---|---|
IMAGOR_SECRET | — | Secret key for URL signing; required in production |
IMAGOR_UNSAFE | off | Disable URL signature verification — development only |
IMAGOR_SIGNER_TYPE | sha1 | Signature algorithm: sha1, sha256 or sha512 |
IMAGOR_SIGNER_TRUNCATE | — | Truncate the URL signature to this length |
IMAGOR_AUTO_WEBP | off | Serve WebP automatically when the browser supports it |
IMAGOR_AUTO_AVIF | off | Serve AVIF automatically when the browser supports it |
IMAGOR_AUTO_JPEG | off | Serve JPEG when JPEG was requested or no format was requested |
IMAGOR_PASSTHROUGH_FORMATS | — | Serve a source format as-is for requests that ask for nothing; only svg is accepted |
IMAGOR_SANITIZE_SVG | on | Sanitize SVG before pass-through; turning it off serves the document byte for byte |
IMAGOR_BASE_PARAMS | — | Base params applied to every image, e.g. filters:watermark(logo.png) |
IMAGOR_CACHE_HEADER_TTL | 168h | HTTP Cache-Control max-age for successful responses |
IMAGOR_CACHE_HEADER_SWR | 24h | stale-while-revalidate window |
IMAGOR_CACHE_HEADER_NO_CACHE | off | Send Cache-Control: no-cache on every response |
IMAGOR_REQUEST_TIMEOUT | 30s | Overall request timeout |
IMAGOR_LOAD_TIMEOUT | — | Loader fetch timeout; should be shorter than the request timeout |
IMAGOR_SAVE_TIMEOUT | — | Storage save timeout |
IMAGOR_PROCESS_TIMEOUT | — | Image processing timeout |
IMAGOR_PROCESS_CONCURRENCY | -1 | Max concurrent image operations; -1 means unlimited |
IMAGOR_PROCESS_QUEUE_SIZE | 0 | Max queued requests before returning 429; 0 means unlimited |
IMAGOR_STORAGE_PATH_STYLE | original | Storage key style for loaders: original or digest |
IMAGOR_RESULT_STORAGE_PATH_STYLE | original | Storage key style for results: original, digest or suffix |
IMAGOR_MODIFIED_TIME_CHECK | off | Compare result and source modified times to avoid stale results |
IMAGOR_DISABLE_PARAMS_ENDPOINT | off | Disable the /params debug endpoint |
IMAGOR_DISABLE_ERROR_BODY | off | Omit the response body on errors |
IMAGOR_RESPONSE_RAW_ON_ERROR | off | Return the raw source image when processing fails |
HTTP Loader
| Variable | Default | What it does |
|---|---|---|
HTTP_LOADER_ALLOWED_SOURCES | any host | Allowlist of hosts, comma separated, with glob support such as *.example.com |
HTTP_LOADER_ALLOWED_SOURCE_REGEXP | — | Allowlist by regular expression, OR-ed with the glob list |
HTTP_LOADER_BASE_URL | — | Prepend a fixed base URL to every image path, so URLs stay short |
HTTP_LOADER_DEFAULT_SCHEME | https | Scheme assumed when the path omits one; set to nil to require full URLs |
HTTP_LOADER_HTTPS_ONLY | off | Refuse plain HTTP image URLs |
HTTP_LOADER_FORWARD_HEADERS | — | Forward named request headers upstream, e.g. Accept,Authorization |
HTTP_LOADER_FORWARD_CLIENT_HEADERS | off | Forward all browser client headers |
HTTP_LOADER_OVERRIDE_RESPONSE_HEADERS | — | Copy named loader response headers into the imagor response |
HTTP_LOADER_PROXY_URLS | — | Route loader requests through one or more proxies, rotated randomly |
HTTP_LOADER_PROXY_ALLOWED_SOURCES | — | Restrict proxy use to specific hosts |
HTTP_LOADER_BLOCK_LOOPBACK_NETWORKS | off | Block loopback addresses such as 127.0.0.1 |
HTTP_LOADER_BLOCK_PRIVATE_NETWORKS | off | Block private ranges such as 10.x.x.x and 192.168.x.x |
HTTP_LOADER_BLOCK_LINK_LOCAL_NETWORKS | off | Block link-local addresses such as 169.254.x.x |
HTTP_LOADER_BLOCK_NETWORKS | — | Block custom CIDR ranges, comma separated |
HTTP_LOADER_MAX_ALLOWED_SIZE | — | Maximum bytes to fetch; a HEAD request checks Content-Length first |
HTTP_LOADER_DISABLE | off | Disable the HTTP loader entirely when you only serve from file or S3 |
Upload Loader
| Variable | Default | What it does |
|---|---|---|
UPLOAD_LOADER_ENABLE | off | Enable POST upload; also requires IMAGOR_UNSAFE=1 |
UPLOAD_LOADER_MAX_ALLOWED_SIZE | 33554432 | Maximum upload size in bytes (32 MiB) |
UPLOAD_LOADER_ACCEPT | image/* | Accepted Content-Type |
UPLOAD_LOADER_FORM_FIELD_NAME | image | Multipart form field name |
File System Storage
| Variable | Default | What it does |
|---|---|---|
FILE_LOADER_BASE_DIR | — | Read source images from this directory; setting it enables the file loader |
FILE_STORAGE_BASE_DIR | — | Write source images here |
FILE_RESULT_STORAGE_BASE_DIR | — | Write processed results here |
FILE_LOADER_PATH_PREFIX | — | Only handle request paths starting with this prefix |
FILE_STORAGE_PATH_PREFIX | — | Same, for source storage |
FILE_RESULT_STORAGE_PATH_PREFIX | — | Same, for result storage |
FILE_SAFE_CHARS | — | Preserve literal characters that would otherwise be escaped, e.g. []; set to -- to disable escaping entirely |
FILE_STORAGE_MKDIR_PERMISSION | 0755 | Permission mode for directories imagor creates |
FILE_STORAGE_WRITE_PERMISSION | 0666 | Permission mode for files imagor writes |
FILE_RESULT_STORAGE_MKDIR_PERMISSION | 0755 | Same, for result storage |
FILE_RESULT_STORAGE_WRITE_PERMISSION | 0666 | Same, for result storage |
FILE_STORAGE_EXPIRATION | — | Treat older files as expired on retrieval; does not delete them |
FILE_RESULT_STORAGE_EXPIRATION | — | Same, for result storage |
S3 and S3-Compatible Storage
| Variable | Default | What it does |
|---|---|---|
S3_LOADER_BUCKET | — | Load source images from this bucket |
S3_STORAGE_BUCKET | — | Store source images in this bucket |
S3_RESULT_STORAGE_BUCKET | — | Store processed results in this bucket |
S3_ENDPOINT | AWS | Custom endpoint for R2, MinIO or Spaces, e.g. http://minio:9000 |
S3_FORCE_PATH_STYLE | off | Use endpoint/bucket/key instead of bucket.endpoint/key |
AWS_REGION | — | Region used by all three roles |
AWS_ACCESS_KEY_ID | — | Credential used by all three roles |
AWS_SECRET_ACCESS_KEY | — | Secret used by all three roles |
AWS_LOADER_REGION | — | Override the region for the loader only |
AWS_STORAGE_REGION | — | Override the region for source storage only |
AWS_RESULT_STORAGE_REGION | — | Override the region for result storage only |
S3_LOADER_ENDPOINT | — | Override the endpoint for the loader only |
S3_STORAGE_ENDPOINT | — | Override the endpoint for source storage only |
S3_RESULT_STORAGE_ENDPOINT | — | Override the endpoint for result storage only |
S3_LOADER_BASE_DIR | — | Key prefix inside the bucket for source images |
S3_STORAGE_BASE_DIR | — | Key prefix for stored source images |
S3_RESULT_STORAGE_BASE_DIR | — | Key prefix for results |
S3_LOADER_PATH_PREFIX | — | Only handle request paths starting with this prefix |
S3_SAFE_CHARS | — | Preserve literal characters in object keys, e.g. [] |
S3_STORAGE_CLASS | STANDARD | Storage class for written objects, e.g. STANDARD_IA |
S3_STORAGE_ACL | — | Canned ACL for stored source images, e.g. public-read |
S3_RESULT_STORAGE_ACL | — | Canned ACL for stored results |
S3_RESULT_STORAGE_EXPIRATION | — | Treat older objects as expired on retrieval |
S3_LOADER_BUCKET_ROUTER_CONFIG | — | Path to a YAML file mapping paths to buckets by pattern |
VIPS and Image Processing
These are the settings that decide how much work one request can cost you, which makes them the most important group in the whole file.
| Variable | Default | What it does |
|---|---|---|
VIPS_CONCURRENCY | -1 | libvips worker threads per operation; keep at 1 unless you have benchmarked otherwise |
VIPS_MAX_WIDTH | — | Reject images wider than this |
VIPS_MAX_HEIGHT | — | Reject images taller than this |
VIPS_MAX_RESOLUTION | — | Reject images above this width × height |
VIPS_UNLIMITED | off | Bypass all resolution limits; not recommended on a public endpoint |
VIPS_MAX_ANIMATION_FRAMES | — | Frames to load from animated sources; 1 disables animation, -1 is unlimited |
VIPS_MAX_FILTER_OPS | -1 | Maximum filter operations per request; -1 is unlimited |
VIPS_DISABLE_BLUR | off | Disable all blur operations |
VIPS_DISABLE_FILTERS | — | Disable specific filters by name, comma separated |
VIPS_MOZJPEG | off | Use MozJPEG for JPEG encoding; requires the imagor-mozjpeg build |
VIPS_AVIF_SPEED | 8 | AVIF encode speed from 0 (smallest file) to 9 (fastest) |
VIPS_STRIP_METADATA | off | Strip all metadata from output images |
VIPS_STRIP_COLOR_PROFILE | off | Strip embedded ICC profiles while keeping other metadata |
VIPS_DETECTOR_PROBE_SIZE | 400 | Image size probed for smart crop focal detection |
VIPS_CACHE_SIZE | 0 | In-memory pixel cache budget in bytes; 0 disables it |
VIPS_CACHE_MAX_WIDTH | 2400 | Largest width the pixel cache will store |
VIPS_CACHE_MAX_HEIGHT | 2000 | Largest height the pixel cache will store |
VIPS_CACHE_TTL | 0 | Cache entry lifetime; 0 means no expiry, LRU eviction only |
VIPS_CACHE_FORMAT | pixel | How cached pixels are held: pixel, png or webp |
Monitoring and Logging
| Variable | Default | What it does |
|---|---|---|
PROMETHEUS_BIND | disabled | Address to expose Prometheus metrics on, e.g. :5000 |
PROMETHEUS_PATH | / | Metrics path |
PROMETHEUS_NAMESPACE | imagor | Metrics namespace prefix |
SENTRY_DSN | — | Enables Sentry error reporting when set |
LOG_ECS | off | Use Elastic Common Schema log format |
The Variables That Matter Most
The tables above are the reference. These are the settings with real consequences, explained one at a time.
IMAGOR_SECRET
Purpose: the HMAC key that signs every request path. With it set, imagor rejects any URL that does not carry a matching signature, which is what stops a public instance from being used as free CPU for someone else’s resizing.
Format: any string. Length and randomness are what matter, not the format.
Default: unset. With no secret and no unsafe flag, signed requests cannot be verified.
|
1 2 |
environment: IMAGOR_SECRET: ${IMAGOR_SECRET} |
Security note: rotating this secret invalidates every URL already generated and cached in a browser or CDN. Plan the rotation, or you will spend an afternoon debugging a wave of 403s.
IMAGOR_UNSAFE
Purpose: disables signature verification entirely, so any URL that reaches the server gets processed.
Format: 1 to enable, unset to disable.
Default: off.
|
1 2 |
environment: IMAGOR_UNSAFE: 1 |
Security note: this is a development switch. Left on in production, anyone who learns your hostname can burn your CPU, and the max_age() filter lets them set arbitrarily long cache lifetimes on your behalf.
IMAGOR_SIGNER_TYPE
Purpose: chooses the HMAC algorithm used for signing. The default is SHA1 because that is what thumbor uses, and SHA1 is no longer considered cryptographically secure.
Format: sha1, sha256 or sha512.
Default: sha1.
|
1 2 3 |
environment: IMAGOR_SIGNER_TYPE: sha256 IMAGOR_SIGNER_TRUNCATE: 40 |
Security note: changing the signer type changes the hash your application must produce. Update your signing code and imagor together, or every URL fails at once.
IMAGOR_AUTO_WEBP and IMAGOR_AUTO_AVIF
Purpose: serve a modern format automatically based on the browser’s Accept header, without changing the URL. WebP is safe everywhere that matters; AVIF is still marked experimental in the docs and costs noticeably more CPU per encode.
Format: 1 to enable.
Default: off for both.
|
1 2 3 |
environment: IMAGOR_AUTO_WEBP: 1 IMAGOR_AUTO_AVIF: 1 |
Security note: none, but be aware of the cost. AVIF encoding is the most expensive thing imagor does, so enable it only if you have CPU headroom to spare.
IMAGOR_PROCESS_CONCURRENCY
Purpose: caps how many image operations run at the same time. Without a cap, a burst of requests can saturate every core and make the whole box unresponsive, including whatever else runs on it.
Format: an integer. -1 means unlimited.
Default: -1.
|
1 2 3 |
environment: IMAGOR_PROCESS_CONCURRENCY: 20 IMAGOR_PROCESS_QUEUE_SIZE: 100 |
Security note: this is your cheapest denial-of-service defence. Pair it with IMAGOR_PROCESS_QUEUE_SIZE so excess requests get a 429 instead of queueing forever.
IMAGOR_REQUEST_TIMEOUT and IMAGOR_LOAD_TIMEOUT
Purpose: bound how long a single request may take in total, and how long imagor will wait for a source image to arrive.
Format: a Go duration string such as 30s, 10s or 2m.
Default: IMAGOR_REQUEST_TIMEOUT is 30s; the load timeout is unset.
|
1 2 3 |
environment: IMAGOR_REQUEST_TIMEOUT: 30s IMAGOR_LOAD_TIMEOUT: 10s |
Security note: keep the load timeout shorter than the request timeout. A loader hanging on a slow third-party host should fail on its own terms rather than eating the whole request budget.
HTTP_LOADER_ALLOWED_SOURCES
Purpose: restricts which hosts imagor will fetch images from. Without it, a signed URL can point at any address on the internet, including internal ones if you have not blocked private ranges.
Format: a comma-separated list of hostnames, with glob wildcards supported.
Default: any host.
|
1 2 3 4 5 |
environment: HTTP_LOADER_ALLOWED_SOURCES: "*.mydomain.com,assets.cdn.io" HTTP_LOADER_HTTPS_ONLY: 1 HTTP_LOADER_BLOCK_PRIVATE_NETWORKS: 1 HTTP_LOADER_BLOCK_LOOPBACK_NETWORKS: 1 |
Security note: pair this with the SSRF protection flags. The allowlist stops image URLs pointing outward at arbitrary hosts, and the network blocks stop them pointing inward at your own infrastructure.
VIPS_MAX_RESOLUTION
Purpose: rejects images whose width multiplied by height exceeds a limit. This is the defence against decompression bombs, where a small file expands into gigabytes of pixel data in memory.
Format: an integer representing total pixels.
Default: unset, meaning no limit.
|
1 2 3 4 5 |
environment: VIPS_MAX_RESOLUTION: 16800000 VIPS_MAX_WIDTH: 5000 VIPS_MAX_HEIGHT: 5000 VIPS_MAX_ANIMATION_FRAMES: 100 |
Security note: 16,800,000 pixels is roughly 4K by 4K, which is generous for web imagery and still small enough to bound memory use. Never set VIPS_UNLIMITED on an endpoint that accepts sources you do not control.
VIPS_CACHE_SIZE
Purpose: enables an in-memory cache of decoded pixel data, keyed by image path. The same base image, watermark or overlay is decoded once and reused, which matters when one logo appears on every image you serve.
Format: a byte budget, for example 52428800 for 50 MiB.
Default: 0, which disables the cache.
|
1 2 3 4 5 |
environment: VIPS_CACHE_SIZE: 52428800 VIPS_CACHE_MAX_WIDTH: 2400 VIPS_CACHE_MAX_HEIGHT: 2000 VIPS_CACHE_FORMAT: webp |
Security note: leave this disabled if source paths are highly varied or user-supplied, because a cache that never hits is just wasted memory. Also set VIPS_CACHE_TTL if source images can change at the same path, otherwise stale pixels are served until eviction.
PROMETHEUS_BIND
Purpose: exposes Prometheus metrics on a separate address, so you can graph request rate, latency and concurrency alongside the rest of your stack.
Format: an address and port, for example :5000.
Default: disabled when unset.
|
1 2 3 4 |
environment: PROMETHEUS_BIND: ":5000" PROMETHEUS_PATH: /metrics PROMETHEUS_NAMESPACE: imagor |
Security note: the metrics port has no authentication. Keep it on an internal network, or bind it to localhost and let your scraper reach it from the same host.
Storage Backends
imagor separates three roles, and understanding the difference is the key to configuring it well:
- Loader — loads the source image. This is where your originals live.
- Storage — loads and saves source images for reuse on later requests. Useful when sources come from somewhere slow or remote and you want a local copy.
- Result storage — loads and saves processed images. This is the cache that turns a second request into a file read.
Each role can use a different backend, and the HTTP loader is always the fallback when nothing else handles a path. You enable a role by setting its base directory or bucket variable — there is no separate on/off switch.
The HTTP Loader
Enabled by default, this fetches images from remote URLs over HTTP or HTTPS. It is what makes imagor useful out of the box, and it is also the biggest risk surface on a public instance, which is why the allowlist and the SSRF blocking flags exist.
Two settings make it much nicer to use. HTTP_LOADER_BASE_URL prepends a fixed origin to every image path, so your URLs shrink dramatically — useful when everything you serve comes from one bucket or one host. And HTTP_LOADER_MAX_ALLOWED_SIZE caps how many bytes imagor will pull, checking Content-Length with a HEAD request first.
|
1 2 3 |
environment: HTTP_LOADER_BASE_URL: https://raw.githubusercontent.com/cshum/imagor/master HTTP_LOADER_MAX_ALLOWED_SIZE: 20971520 |
With that base URL set, a path like /unsafe/400x400/testdata/gopher.png resolves to the full GitHub raw URL without you spelling it out. If you serve from only one origin, this is the single biggest quality-of-life improvement in the whole configuration.
File System
The simplest real deployment: mount a directory and let imagor read from it. Enable the loader by setting FILE_LOADER_BASE_DIR, add result storage with FILE_RESULT_STORAGE_BASE_DIR, and you have a working image server backed by files on the host.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
services: imagor: image: shumc/imagor:latest volumes: - ./:/mnt/data ports: - "8000:8000" environment: PORT: 8000 IMAGOR_UNSAFE: 1 FILE_LOADER_BASE_DIR: /mnt/data FILE_STORAGE_BASE_DIR: /mnt/data FILE_RESULT_STORAGE_BASE_DIR: /mnt/data/result FILE_STORAGE_MKDIR_PERMISSION: 0755 FILE_STORAGE_WRITE_PERMISSION: 0666 |
Two details that trip people up. First, imagor normalizes paths and escapes reserved characters by default, and it rejects dotfile-style segments such as /.git for safety. If your filenames contain literal brackets, add FILE_SAFE_CHARS: "[]". Second, the expiration settings only make imagor treat old files as expired on retrieval — they never delete anything from disk. Cleanup is your problem, and a cron job is the usual answer.
S3 and S3-Compatible Storage
This is the deployment that scales, and the one most people should aim for. imagor speaks the standard S3 API, so it works against AWS S3, Cloudflare R2, MinIO and DigitalOcean Spaces with no code changes — only the endpoint differs.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
services: imagor: image: shumc/imagor:latest ports: - "8000:8000" environment: PORT: 8000 IMAGOR_SECRET: ${IMAGOR_SECRET} AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID} AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY} AWS_REGION: us-east-1 S3_LOADER_BUCKET: my-images S3_LOADER_BASE_DIR: originals S3_RESULT_STORAGE_BUCKET: my-images S3_RESULT_STORAGE_BASE_DIR: cache S3_RESULT_STORAGE_ACL: private |
For a self-hosted S3-compatible service, point it at your endpoint and switch to path-style addressing, because bucket-as-subdomain does not work when the host is a container name.
|
1 2 3 |
environment: S3_ENDPOINT: http://minio:9000 S3_FORCE_PATH_STYLE: 1 |
That S3_FORCE_PATH_STYLE line is the most commonly missing setting in self-hosted setups. Without it, imagor builds requests like http://mybucket.minio:9000/image.jpg, which fails to resolve, and the logs show a loader error that looks nothing like a DNS problem.
Security note: use separate credentials per role where you can, through the AWS_LOADER_*, AWS_STORAGE_* and AWS_RESULT_STORAGE_* variables. A loader key that can only read originals cannot be abused to overwrite your cache or your sources if the container is ever compromised.
Google Cloud Storage
Google Cloud Storage is supported for all three roles with the same shape of configuration: a GCLOUD_*_BUCKET variable enables a role, with optional base directory, path prefix, ACL and expiration settings. If you are already on GCP nothing here will surprise you, and if you are not, S3 compatibility covers a wider range of providers.
The Metadata Endpoints
imagor has two endpoints that are easy to miss and genuinely useful. Add /meta right after the signature hash and before the operations, and instead of an image you get JSON describing it: format, content type, width, height, orientation, page count, colour bands and EXIF.
|
1 |
curl "http://localhost:8000/unsafe/meta/fit-in/50x50/raw.githubusercontent.com/cshum/imagor/master/testdata/Canon_40D.jpg" |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
{ "format": "jpeg", "content_type": "image/jpeg", "width": 50, "height": 34, "orientation": 1, "pages": 1, "bands": 3, "exif": { "Make": "Canon", "Model": "Canon EOS 40D", "DateTime": "2008:07:31 10:38:11" } } |
It does this cheaply by reading just enough of the source to extract the header, rather than decoding the whole image. That makes it practical to call from an application that needs to know dimensions before choosing a layout.
Three metadata filters add computed values, and they are the answer to placeholder images. blurhash(4,3) produces a BlurHash string you can render as a blurry preview while the real image loads, thumbhash() produces a ThumbHash with better colour reproduction and transparency support, and avgcolor() gives you the average colour as an RGB triple for a solid placeholder.
|
1 |
curl "http://localhost:8000/unsafe/meta/filters:blurhash(4,3):avgcolor()/raw.githubusercontent.com/cshum/imagor/master/testdata/gopher.png" |
The second endpoint is /params. Prepending it to any existing URL returns the parsed endpoint attributes as JSON, which is the fastest way to find out why a URL is not doing what you expected. It is enabled by default; IMAGOR_DISABLE_PARAMS_ENDPOINT turns it off.
How Caching Works
imagor has three independent cache layers, and confusing them is the usual reason people think the server is slow. From outermost to innermost:
- HTTP cache headers — sent to the browser and any CDN in front of imagor. Controlled by
IMAGOR_CACHE_HEADER_TTL, which defaults to 168 hours, andIMAGOR_CACHE_HEADER_SWR, which defaults to 24 hours ofstale-while-revalidate. - Result storage — processed images written to disk or a bucket. A repeat request for the same transformation becomes a static read. Off unless you set a result storage variable.
- In-memory pixel cache — decoded source pixels held in RAM, keyed by image path. Off unless you set
VIPS_CACHE_SIZE.
Two filters let you override caching per response, which is more useful than it sounds. max_age(seconds) sets the Cache-Control lifetime for that one URL, and it takes precedence over the global TTL in both directions — you can extend or shorten it. max_age(0) marks a response as non-cacheable. expire(timestamp) sets an absolute deadline in Unix milliseconds, and when both are present the more restrictive one wins.
|
1 2 3 |
/unsafe/400x400/filters:max_age(3600)/photo.jpg cache for one hour /unsafe/400x400/filters:max_age(0)/photo.jpg never cache /unsafe/400x400/filters:expire(1790000000000)/photo.jpg expire at a deadline |
Security note: with IMAGOR_UNSAFE enabled, anyone can craft a URL with an arbitrarily large max_age and fill caches with content you did not intend to keep. This is one more reason signatures belong in production.
There is also preview(), which skips result storage for a request and opts the base image into the in-memory cache instead. It is designed for preview contexts where the same source is requested at many different sizes — exactly the case where writing a hundred result files is wasteful but holding the decoded source is not.
One setting worth knowing about if your images change at stable paths: IMAGOR_MODIFIED_TIME_CHECK compares the result and source modified times and regenerates when the source is newer. Without it, a stale result can be served indefinitely, because the result storage key is derived from the request path and has no idea your source image changed.
Volume Mounts Explained
imagor needs no volume to function, which is unusual for a self-hosted service and worth appreciating. Volumes appear only when you choose the file system backend.
The Data Directory
Purpose: holds whatever the file system backend reads and writes. Which parts of it are used depends entirely on which FILE_*_BASE_DIR variables you set.
Typical mount: ./data:/mnt/data. The documentation’s own examples use /mnt/data; the path is arbitrary as long as your environment variables agree with it.
What lives there:
- Your source images, if
FILE_LOADER_BASE_DIRpoints here - Copies of source images, if
FILE_STORAGE_BASE_DIRis set - Processed results, usually in a subdirectory such as
result/, ifFILE_RESULT_STORAGE_BASE_DIRis set
Practical usage: a bind mount is easier to inspect than a named volume here, because being able to look at the result directory with ls is how you confirm caching is actually happening. If you only use S3 or the HTTP loader, you can omit the volume entirely and run the container with no persistent storage at all.
The Bucket Router Configuration
Purpose: a YAML file that maps request paths to S3 buckets by regular expression, for setups where a single imagor instance serves many buckets.
Typical mount: ./bucket-routing.yaml:/etc/imagor/bucket-routing.yaml, referenced by S3_LOADER_BUCKET_ROUTER_CONFIG.
Practical usage: the pattern must contain a named capture group called bucket to extract the bucket identifier, which is then matched against the rules in the file. If no rule matches, the default bucket is used, and up to two fallback buckets are tried in order. Only relevant for multi-tenant deployments; skip it otherwise.
Common Use Cases
Replacing a CMS Image CDN
A WordPress or Drupal site generating thumbnails on upload, with a plugin writing derived files into the uploads directory, is the classic candidate. Point imagor at the same media directory with FILE_LOADER_BASE_DIR, then change your theme to build URLs instead of referencing pre-generated files. The original upload stays the only file on disk, and every size in your design becomes a URL parameter. Add IMAGOR_AUTO_WEBP: 1 and the same URLs start serving WebP to browsers that accept it, with no markup changes.
A Thumbnail Service for User Uploads
You accept image uploads from users and need avatars, preview cards and full views. Store the originals in S3 with S3_LOADER_BUCKET, enable S3_RESULT_STORAGE_BUCKET for the derived sizes, and use smart crop so a portrait photo produces a usable square avatar without any manual cropping logic in your application. This is where the URL syntax pays off: three different crops of the same source are three strings, not three code paths.
Branding Every Image Automatically
Instead of baking a watermark into files at upload time, set IMAGOR_BASE_PARAMS to a watermark filter and every image gets branded on the way out. Because base params apply to all requests, you can turn branding on or off for the whole instance by changing one environment variable, and the originals stay clean for print or licensing use.
|
1 2 |
environment: IMAGOR_BASE_PARAMS: "filters:watermark(logo.png,repeat,bottom,0,20,20)" |
Instant Placeholders Without a Design Step
Call the metadata endpoint with the blurhash or average colour filter when an image is first uploaded, store the result in your database, and render a soft placeholder in your markup while the real image loads. It removes the flash of empty boxes that makes an image-heavy page feel slow, and it costs one request per image rather than a design asset per image.
A Private Photo Library
You want to serve images only to logged-in users without exposing your bucket publicly. Keep the bucket private, keep the S3 credentials inside the container, and generate signed URLs with a short expiry so a copied link stops working. Combined with HTTP_LOADER_DISABLE: 1, the instance can only ever reach your own storage, which makes the security story simple to explain to anyone who asks.
Video Thumbnails Alongside Images
If you need a poster frame from a video, imagorvideo is the same server with ffmpeg compiled in, so the same URL syntax produces video thumbnails. You can run it as a second container on a different port and route video paths to it, keeping the standard imagor image lean for the image workload.
Useful Links
- imagor — Official Website
- imagor Documentation
- cshum/imagor — GitHub Repository
- shumc/imagor — Docker Hub
- imagor — GitHub Container Registry
- Image Endpoint — URL Syntax Reference
- Filters — Full Filter Reference
- Configuration — All Flags and Variables
- Security — Signing, Expiry and Limits
- Storage — Loaders, Storage and Result Storage
- Benchmarks — Performance Comparison
- image-servers-benchmark — Benchmark Project
- Imagor Studio — URL Builder and Playground
- imagorvideo — Video Thumbnails
- imagorface — Face Detection for Smart Crop
- libvips — Image Processing Library
- thumbor — The URL Syntax imagor Adopts
- imgproxy — Alternative Image Server
Glossary
- Loader
- The component that fetches the source image. imagor ships with an HTTP loader and can read from the file system, S3 or Google Cloud Storage.
- Storage
- Reads and writes source images so they can be reused on later requests. Different from result storage, which holds processed output.
- Result storage
- The processed-image cache. When enabled, a repeat request for the same transformation is served as a static file instead of being re-encoded.
- libvips
- The image processing library imagor binds to. It is demand-driven and streams data, which is why it handles large images with modest memory and why imagor is fast.
- URL signature
- An HMAC hash of the request path, computed with your secret and prepended to the path. It proves the request came from your application rather than from anyone who guessed a URL.
- Unsafe mode
- The
/unsafe/path prefix, which skips signature verification entirely. Convenient in development, dangerous in production. - thumbor URL syntax
- The URL grammar imagor adopts, where operations appear as path segments before the image path. It means imagor can replace an existing thumbor instance without rewriting your URL generation.
- Smart crop
- Focal-point detection that chooses the crop region for you, so the same source image can be cropped to several aspect ratios without manual coordinates.
- Image bomb
- A small file that expands into an enormous pixel buffer when decoded. Blocked with
VIPS_MAX_RESOLUTION,VIPS_MAX_WIDTHandVIPS_MAX_HEIGHT. - SSRF
- Server-Side Request Forgery: tricking a server into fetching a URL of the attacker’s choosing. The
HTTP_LOADER_BLOCK_*_NETWORKSsettings exist to prevent imagor being used that way against your internal network. - BlurHash and ThumbHash
- Compact string representations of an image that render as a blurry placeholder while the real file loads. imagor computes both through its metadata endpoint.
- Blob
- In imagor’s internals, the object that represents a decoded image and its metadata. Blob reuse is one of the reasons its request path is efficient.
Conclusion
imagor is one of the better examples of a tool that does one job and does it without ceremony. A single container, one port, no database, and an HTTP interface that takes a URL and returns an image. If you have been paying a SaaS image CDN to resize pictures, the replacement cost here is a VPS you probably already own.
The URL syntax is the part worth investing an hour in, because it is where the leverage is. Once you can express a crop, a fill, a filter chain and an output format as a path, your application stops containing image logic entirely. A template emits a URL; the server does the work. Changing a design becomes changing a string, and generating a new size stops being a migration.
The configuration surface looks large, and honestly it is, but the shape of a good deployment is small. Set IMAGOR_SECRET, remove IMAGOR_UNSAFE, allowlist your source hosts, cap resolution and concurrency, and turn on result storage. That is five decisions, and it takes you from a demo to something you can leave running on the public internet.
The honest caveats: the benchmark numbers show imagor and imgproxy trading wins rather than one dominating, so pick on features and licensing rather than a few requests per second. There is no web interface, so debugging means reading logs and using /params. And the security model only works if you actually use it — a public imagor instance in unsafe mode is an open invitation to burn your CPU, and it will be found.
Get those things right and you have an image server that is fast, private, and boring in the best way. Boring infrastructure is the goal; imagor is very good at it.
FAQ
What is imagor?
imagor is a fast, secure image processing server written in Go and built on libvips. You give it a URL containing the resize, crop and filter operations you want, and it returns the processed image. It runs as a single Docker container with no database and no external state.
Is imagor free and open source?
Yes. imagor is released under the Apache 2.0 license and the full source is on GitHub at cshum/imagor. There are no paid tiers, seat limits or gated features. The maintainer offers commercial consulting, but it is entirely optional.
How is imagor different from thumbor?
Both use the same URL syntax, so imagor can act as a drop-in replacement. The difference is the engine: thumbor uses Pillow, while imagor uses libvips through a generated Go binding. On the project’s published benchmarks imagor was faster than thumbor on JPEG, PNG, WebP and AVIF.
How is imagor different from imgproxy?
Both are libvips-based, so performance is close. In the May 2026 benchmark rerun imagor led on PNG and AVIF while imgproxy led on JPEG and WebP. The practical differences are the URL syntax, since imagor follows thumbor, and the licensing model, since imgproxy has a commercial tier for some features.
Which Docker image and tag should I use?
Use shumc/imagor from Docker Hub. For anything you intend to keep running, pin a version tag such as 1.9.10 rather than using latest, so a restart cannot silently change behaviour. Master builds are also published if you want to test unreleased changes.
Do I need to install libvips on my server?
No. The official image ships with libvips 8.18.7 baked in, along with jemalloc preloaded and the required font configuration. You only need libvips on the host if you build imagor from source, which most people never need to do.
Do I need IMAGOR_UNSAFE in production?
No, and you should not use it. Unsafe mode disables signature verification, so any URL that reaches the server gets processed. Set IMAGOR_SECRET instead and have your application sign URLs. Keep unsafe mode for local development and the first few minutes of testing.
How do I create a signed imagor URL?
Compute an HMAC of the request path, meaning everything after the hash without a leading slash, base64url encode it, and prepend it to the path. The default algorithm is SHA1 for thumbor compatibility; switch to SHA256 with IMAGOR_SIGNER_TYPE and use the same algorithm in your signing code.
Why am I getting a 403 Forbidden from imagor?
Almost always a signature mismatch. Check that you are signing the path without a leading slash, that the algorithm matches IMAGOR_SIGNER_TYPE, and that any IMAGOR_SIGNER_TRUNCATE length is applied in your code as well. Rotating IMAGOR_SECRET also invalidates every URL that was already generated.
How much RAM and CPU does imagor need?
Less than you would expect, because libvips streams data rather than loading whole images into memory. A single vCPU and 512 MB of RAM handles a modest workload. The real constraints are CPU time per encode, especially for AVIF, and bandwidth when serving many viewers.
Can imagor run on a Raspberry Pi or an ARM server?
Yes, multi-architecture images are published, so it runs on ARM64 hardware such as a Raspberry Pi 4 or 5 and on ARM VPS instances. Keep expectations realistic: a Pi is fine for a personal site or a small library, but heavy AVIF encoding or a busy public site will want more CPU.
How do I stop strangers from using my imagor instance?
Four settings do most of the work: set IMAGOR_SECRET so every URL must be signed, remove IMAGOR_UNSAFE, restrict HTTP_LOADER_ALLOWED_SOURCES to hosts you control, and cap VIPS_MAX_RESOLUTION and IMAGOR_PROCESS_CONCURRENCY. Together they stop unsigned use, arbitrary source fetching and resource exhaustion.
How does smart crop decide what to keep?
It uses focal point detection to find the visually important region of the image and anchors the crop there instead of centring it. The probe size is tunable with VIPS_DETECTOR_PROBE_SIZE. For face-aware cropping, the imagorface plugin extends the detector to anchor on faces instead.
What is the difference between fit-in and a plain resize?
A plain WxH resize scales the image and crops the overflow so the output is exactly that size. fit-in scales the image so it fits entirely inside the box, which may leave empty space, and you usually pair it with the fill() filter to paint that space with a colour, a blur or the average colour.
Can imagor serve WebP or AVIF automatically?
Yes. Set IMAGOR_AUTO_WEBP and IMAGOR_AUTO_AVIF to 1 and imagor negotiates the format from the browser’s Accept header, so the same URL serves a modern format where it is supported. WebP is a safe default; AVIF is marked experimental and costs significantly more CPU per encode.
Does imagor handle animated GIFs and SVG?
Animated GIFs are supported, and VIPS_MAX_ANIMATION_FRAMES controls how many frames are loaded, so you can cap the cost of a heavy animation. SVG can be rasterised like any other image, and with IMAGOR_PASSTHROUGH_FORMATS set to svg a sanitised SVG can be served through untouched.
How do I serve images from S3, MinIO or Cloudflare R2?
Set S3_LOADER_BUCKET to the bucket holding your originals, add S3_RESULT_STORAGE_BUCKET for the processed cache, and provide AWS_REGION plus credentials. For non-AWS providers also set S3_ENDPOINT and S3_FORCE_PATH_STYLE=1, because bucket-as-subdomain does not work against a self-hosted endpoint.
Why do my MinIO or R2 requests fail with a DNS error?
This is the classic S3_FORCE_PATH_STYLE omission. By default the S3 client prepends the bucket name as a subdomain, so a request goes to mybucket.minio:9000, which cannot resolve. Setting S3_FORCE_PATH_STYLE=1 makes it use minio:9000/mybucket instead, and the error disappears.
Why is the second request for the same image still slow?
Because result storage is not enabled, so nothing was cached. Set FILE_RESULT_STORAGE_BASE_DIR or S3_RESULT_STORAGE_BUCKET and the second request becomes a static read. If caching is on and it is still slow, check whether the request includes crop coordinates, which always bypass the in-memory pixel cache.
Does imagor have a web interface?
No, and that is deliberate. imagor is an API-only service with no admin panel to secure. For building and testing URLs visually you can use Imagor Studio, the maintainer’s hosted playground, which generates a path you can paste straight into your own instance.
How do I check whether imagor is working?
Run a curl against a known image and write the output to a file, then open it. There is no dashboard and no health page, so a valid image response is the signal. If that fails, check the container logs, then use the /params endpoint to see how imagor parsed the URL.
Can I use imagor with WordPress or another CMS?
Yes, and it is one of the strongest use cases. Point FILE_LOADER_BASE_DIR at your uploads directory or S3_LOADER_BUCKET at your media bucket, then have your theme emit imagor URLs instead of referencing pre-generated thumbnails. The original upload remains the only file stored.
What happens when the source image is missing or too large?
A missing source returns an error, and IMAGOR_DISABLE_ERROR_BODY lets you suppress the error body if you prefer. An oversized source is rejected once VIPS_MAX_RESOLUTION, VIPS_MAX_WIDTH or VIPS_MAX_HEIGHT is set. IMAGOR_RESPONSE_RAW_ON_ERROR can return the untouched source instead of failing outright.
Does imagor support watermarking and text overlays?
Yes. The watermark() filter places an image with position, alpha and size ratio controls and can tile it, while text() draws text with font, colour, alignment and wrapping options. Set IMAGOR_BASE_PARAMS to a watermark filter and every image on the instance gets branded automatically.
Can I run several imagor instances behind one hostname?
Yes, and it is straightforward because imagor holds no state that needs coordinating. Run multiple containers behind a load balancer, point them at the same result storage, and the cache is shared. The in-memory pixel cache is per instance, which is fine because it is only an optimisation.
