Pixtimize is an opensource image transform api compatible with imagekit API. Pixtimize is compatbile with any S3 bucket service.
We use bun for having a blasting fast API
- Bun and Elysiajs as web framework and runtime
- Redis to store the image cached key
Property name | compatible | comment |
---|---|---|
w | ✅ | fix pixel values and percentage are supported but not Sec-CH-Width |
h | ✅ | fix pixel values and percentage are supported but not Sec-CH-Width |
q | ✅ | quality of the image, default value is DEFAULT_QUALITY .env |
f | ✅ | quality of the image, default value is DEFAULT_FORMAT .env, values are jpeg, jpg, png, webp |
You can transform the image by calling your url like this, don't forget encoding the & param
https://yourdomain.com/image-example.png?tr=w-606,h-450,f-jpeg
or
https://yourdomain.com/tr:w-606,h-450,f-jpeg/image-example.png
Some environment variables are required:
S3_ENDPOINT
: URL of the s3 bucketS3_BUCKET
: name of the s3 bucketS3_KEY
: accessKeyId of the s3 bucketS3_SECRET
: Secret key of the s3 bucketREDIS_URL
: Redis URL
Make sure to set these environment variables before running the application.
Optionnal environment variables
DEFAULT_QUALITY
: The quality which will be rendered by default to optimize the imageDEFAULT_FORMAT
: The format which will be rendered by defaultMODE
: "redirect" default value to redirect to the cached image or "remote" to download and resend the image cached
To start the project:
To install the packages
bun i
To start the project
bun start
To start the project as dev mode
bun dev