Image proxy that applies image transformations to the given image.
To generate an image with ratio 40/30 and with 10% margin that is resize to 200 height before
<proxy_base_url>/scale/rh200-s30x40-m10/<url>
GET/scale/- Scale modes<a size>x<b size>- Scale with ratior<w|h><pixels>- Resize image to maxw(width) or maxh(height)m<percentage>- Add margin from percentage base on original size, this makes the image biggero<portrait|landscape>- Force orientation of the imagebw- Black and white
Resize is performed after all options.
Examples
s40x30- Scale by 40 / 30rw1000- Resize image to width 1000- Scale with margin
s40x30-m10- Scale by 40 / 30 with added percentage margin of the shortest side
Copy config.example.toml to config.toml. Every value can be overridden with
an environment variable prefixed RP__, using a double underscore between
nesting levels, for example RP__APP__API_KEY or
RP__STORAGE__S3__SECRET_ACCESS_KEY. Leave the S3 credentials unset to use the
AWS default credential chain.
Settings that affect throughput:
worker_threads, the number of images processed at the same time (defaults to the CPU count)vips_concurrency, libvips threads per operation. Keepworker_threads * vips_concurrencyclose to the CPU countupload_concurrency, uploads in flight per process requestmax_output_dimension, largest side any output may have, requests above it are rejectedrequest_timeout_secs, after which the request is abandoned and any remaining work is cancelled
The metrics listener (metrics_listen) serves:
/metrics, Prometheus metrics includinghttp_requests_duration_seconds,image_process_duration_seconds,image_decode_duration_seconds,image_encode_duration_seconds{format},image_output_bytes{format},image_upload_duration_secondsandimage_queue_wait_seconds/healthz, liveness
Every response carries an x-request-id header which is also included in the
logs for that request.
cargo test --release --test bench -- --ignored --nocapture posts a 4000px
JPEG with eight configurations and prints p50 and p95 wall time.
- Ensure any install or build dependencies are not in version control.
- Update the README.md with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters.
- You may merge Pull Requests.
- Delete branch after merge.