https://github.com/adamlacombe/sharp-image-proxy
:airplane: An on the fly image optimization microservice
https://github.com/adamlacombe/sharp-image-proxy
avif image-optimization microservice nodejs on-the-fly proxy sharp typescript webp
Last synced: 6 months ago
JSON representation
:airplane: An on the fly image optimization microservice
- Host: GitHub
- URL: https://github.com/adamlacombe/sharp-image-proxy
- Owner: adamlacombe
- License: mit
- Created: 2020-08-30T16:28:13.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-03T00:13:55.000Z (over 4 years ago)
- Last Synced: 2025-03-28T00:51:18.377Z (7 months ago)
- Topics: avif, image-optimization, microservice, nodejs, on-the-fly, proxy, sharp, typescript, webp
- Language: TypeScript
- Homepage: https://adamlacombe.com/blog/how-to-convert-images-to-avif-in-nodejs?utm_source=github&utm_medium=repo_description
- Size: 17.6 KB
- Stars: 20
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# sharp-image-proxy
An on the fly image optimization microservice.
I'm using this to dynamically resize, compress and serve images on my [blog](https://adamlacombe.com/blog/how-to-convert-images-to-avif-in-nodejs?utm_source=github&utm_medium=repo_readme).
It's hosted on [Google Cloud Run](https://cloud.google.com/run) behind [Cloudflare](https://www.cloudflare.com/) with the following page rule settings:

## Run using Docker
```bash
docker run \
-it --rm \
-p 8080:8080 \
--name sharp-image-proxy \
docker.pkg.github.com/adamlacombe/sharp-image-proxy/sharp-image-proxy:latest
```## Features
- Resize images proportionally.
- Support for webp, avif, png, jpeg and tiff.## Options
- url
- width
- height
- format = `webp` | `avif` | `png` | `jpeg` | `tiff`
- quality = `1` - `100` (default `80`)## Example requests
- `/?url=https://via.placeholder.com/500&width=300`
- `/?url=https://via.placeholder.com/500&width=300&format=webp`
- `/?url=https://via.placeholder.com/500&width=300&format=webp&quality=50`
- `/?url=https://via.placeholder.com/500&width=300&format=avif&quality=30`[](https://console.cloud.google.com/cloudshell/editor?shellonly=true&cloudshell_image=gcr.io/cloudrun/button&cloudshell_git_repo=https://github.com/adamlacombe/sharp-image-proxy)