Giter Site home page Giter Site logo

ipx's Introduction

IPX

NPM Vernion NPM Downloads Package Size

High performance, secure and easy to use image proxy based on sharp and libvips.

Usage

Quick Start

You can use ipx command to start server using:

$ npx ipx

The default server directory is the current working directory.

Programatic Usage

You can use IPX as a Connect/Express middleware or directly use ipx api.

import { createIPX, createIPXMiddleware } from "ipx";

const ipx = createIPX(/* options */);
const app = express();
app.use("/image", createIPXMiddleware(ipx));

Examples

The examples assume that a static folder with buffalo.png file is present in the directory where IPX server is running.

Get original image:

http://localhost:3000/_/static/buffalo.png

Change format to webp and keep other things same as source:

http://localhost:3000/f_webp/static/buffalo.png

Keep original format (png) and set width to 200:

http://localhost:3000/w_200/static/buffalo.png

Resize to 200x200px using embed method and change format to webp:

http://localhost:3000/embed,f_webp,s_200x200/static/buffalo.png

Modifiers

Property Docs Example Comments
width / w _ http://localhost:3000/width_200/buffalo.png
height / h _ http://localhost:3000/height_200/buffalo.png
resize / s _ http://localhost:3000/s_200x200/buffalo.png
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

Config can be customized using IPX_* environment variables.

  • IPX_DIR

    • Default: . (current working directory)
  • IPX_DOMAINS

    • Default: []

License

MIT

ipx's People

Contributors

ahmett avatar ascorbic avatar clemcode avatar farnabaz avatar pi0 avatar renovate-bot avatar thomorlo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.