Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
[![NPM Vernion](https://flat.badgen.net/npm/v/ipx)](https://www.npmjs.com/package/ipx) [![NPM Downloads](https://flat.badgen.net/npm/dt/ipx)](https://www.npmjs.com/package/ipx) [![Package Size](https://flat.badgen.net/packagephobia/install/ipx)](https://p
The ipx npm package is an image processing server that allows you to manipulate images on-the-fly. It supports various image transformations such as resizing, cropping, and format conversion, making it useful for web applications that need dynamic image processing.
Resizing Images
This feature allows you to resize images to specified dimensions. In the code sample, the image is resized to a width of 300 pixels and a height of 200 pixels.
const ipx = require('ipx')();
const url = '/_ipx/w_300,h_200/image.jpg';
const result = await ipx(url);
Cropping Images
This feature allows you to crop images to specified dimensions. In the code sample, the image is cropped to a width of 300 pixels and a height of 200 pixels.
const ipx = require('ipx')();
const url = '/_ipx/c_crop,w_300,h_200/image.jpg';
const result = await ipx(url);
Format Conversion
This feature allows you to convert images to different formats. In the code sample, the image is converted to the WebP format.
const ipx = require('ipx')();
const url = '/_ipx/f_webp/image.jpg';
const result = await ipx(url);
Sharp is a high-performance image processing library that supports resizing, cropping, and format conversion. It is known for its speed and efficiency, making it a popular choice for server-side image processing. Compared to ipx, sharp is more of a low-level library that requires more manual setup and configuration.
Jimp is a JavaScript image processing library that supports various image manipulations such as resizing, cropping, and format conversion. It is easy to use and does not require any external dependencies. Compared to ipx, Jimp is more suitable for client-side applications and smaller projects.
GraphicsMagick (gm) is a Node.js wrapper for the GraphicsMagick and ImageMagick image processing libraries. It supports a wide range of image manipulations and is highly configurable. Compared to ipx, gm offers more advanced features but requires the installation of external software.
High performance, secure and easy to use image proxy based on sharp and libvips.
You can use ipx
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";
const ipx = createIPX(/* options */);
const app = 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 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
Property | Docs | Example | Comments |
---|---|---|---|
width | _ | http://localhost:3000/width_200/buffalo.png | |
height | _ | http://localhost:3000/height_200/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 | _ | http://localhost:3000/quality_50/buffalo.png | Accepted values: 0 to 100 |
rotate | Docs | http://localhost:3000/rotate_45/buffalo.png | |
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 using IPX_*
environment variables.
IPX_DIR
.
(current working directory)IPX_DOMAINS
[]
MIT
FAQs
High performance, secure and easy-to-use image optimizer.
The npm package ipx receives a total of 192,924 weekly downloads. As such, ipx popularity was classified as popular.
We found that ipx demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.