- Notifications
You must be signed in to change notification settings - Fork0
High performance, secure and easy to use image proxy based on Sharp and libvips.
License
pi0/ipx
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
High performance, secure and easy to use image proxy based onsharp andlibvips.
You can useipx
command to start server using:
$ npx ipx
The default server directory is the current working directory.
You can use IPX as a Connect/Express middleware or directly use ipx api.
import{createIPX,createIPXMiddleware}from"ipx";constipx=createIPX(/* options */);constapp=express();app.use("/image",createIPXMiddleware(ipx));
The examples assume that a
static
folder withbuffalo.png
file is present in the directory where IPX server is running.
Get original image:
http://localhost:3000/_/static/buffalo.png
Change format towebp
and keep other things same as source:
http://localhost:3000/f_webp/static/buffalo.png
Keep original format (png
) and set width to200
:
http://localhost:3000/w_200/static/buffalo.png
Resize to200x200px
usingembed
method and change format towebp
:
http://localhost:3000/embed,f_webp,s_200x200/static/buffalo.png
Property | Docs | Example | Comments |
---|---|---|---|
width / w | Docs | http://localhost:3000/width_200/buffalo.png | |
height / h | Docs | http://localhost:3000/height_200/buffalo.png | |
resize / s | Docs | http://localhost:3000/s_200x200/buffalo.png | |
fit | Docs | http://localhost:3000/s_200x200,fit_outside/buffalo.png | Setsfit option forresize . |
position / pos | Docs | http://localhost:3000/s_200x200,pos_top/buffalo.png | Setsposition option forresize . |
trim | Docs | http://localhost:3000/trim_100/buffalo.png | |
format | Docs | http://localhost:3000/format_webp/buffalo.png | Supported format:jpg ,jpeg ,png ,webp ,avif ,gif ,heif |
quality / q | _ | http://localhost:3000/quality_50/buffalo.png | Accepted values: 0 to 100 |
rotate | Docs | http://localhost:3000/rotate_45/buffalo.png | |
enlarge | _ | http://localhost:3000/enlarge,s_2000x2000/buffalo.png | Allow the image to be upscaled. By default the returned image will never be larger than the source in any dimension, while preserving the requested aspect ratio. |
flip | Docs | http://localhost:3000/flip/buffalo.png | |
flop | Docs | http://localhost:3000/flop/buffalo.png | |
sharpen | Docs | http://localhost:3000/sharpen_30/buffalo.png | |
median | Docs | http://localhost:3000/median_10/buffalo.png | |
gamma | Docs | http://localhost:3000/gamma_3/buffalo.png | |
negate | Docs | http://localhost:3000/negate/buffalo.png | |
normalize | Docs | http://localhost:3000/normalize/buffalo.png | |
threshold | Docs | http://localhost:3000/threshold_10/buffalo.png | |
tint | Docs | http://localhost:3000/tint_1098123/buffalo.png | |
grayscale | Docs | http://localhost:3000/grayscale/buffalo.png | |
animated | - | http://localhost:3000/animated/buffalo.gif | Experimental |
Config can be customized usingIPX_*
environment variables.
IPX_DIR
- Default:
.
(current working directory)
- Default:
IPX_DOMAINS
- Default:
[]
- Default:
MIT
About
High performance, secure and easy to use image proxy based on Sharp and libvips.
Resources
License
Stars
Watchers
Forks
Packages0
Languages
- TypeScript99.8%
- JavaScript0.2%