npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

imagizer-node

v2.0.0

Published

ESM Imagizer URL builder for server-side JavaScript.

Readme

imagizer-node

imagizer-node is a small ESM client for building Imagizer image URLs on the server.

It takes an image path plus transformation parameters and returns either:

  • a full Imagizer URL such as https://example.cloud.imagizer.com/path/to/image.jpg?w=400
  • a relative URL such as /path/to/image.jpg?w=400

That makes it useful for generating transformed image URLs in Node.js applications, background jobs, templates, and APIs.

Installing

Install the package with your preferred package manager:

pnpm add imagizer-node
npm install imagizer-node

Node >=20.19.0 is required.

This package is ESM-only.

Usage

import ImagizerClient from 'imagizer-node';

const client = new ImagizerClient({
  imagizerHost: 'media.example.imagizer.com',
  useHttps: true,
});

const url = client.buildURL('/products/chair.png', {
  w: 400,
  h: 300,
  crop: 'fit',
});

console.log(url);
// => 'https://media.example.imagizer.com/products/chair.png?w=400&h=300&crop=fit'

API

new ImagizerClient(options)

Creates a client bound to your Imagizer host.

Supported options:

  • imagizerHost: fully qualified Imagizer hostname, without protocol or path
  • useHttps: whether generated full URLs should use https:// or http://; defaults to true

Example:

const client = new ImagizerClient({
  imagizerHost: 'media.example.imagizer.com',
  useHttps: false,
});

client.buildURL(path, params?, returnRelativeURL?)

Builds a URL from an image path and an optional parameter object.

  • path: image path or absolute http:// / https:// URL
  • params: transformation parameters to serialize into the query string
  • returnRelativeURL: when true, returns only the relative path and query; defaults to false

Examples

Relative URLs

Relative URLs are useful when you want to embed generated image paths into other Imagizer features such as layers or watermarks.

const client = new ImagizerClient({
  imagizerHost: 'media.example.imagizer.com',
});

const relativeURL = client.buildURL(
  '/products/chair.png',
  {
    w: 400,
    h: 300,
  },
  true,
);

console.log(relativeURL);
// => '/products/chair.png?w=400&h=300'

External image URLs as input

If you pass a full source URL as the path, imagizer-node percent-encodes it before building the final Imagizer URL.

const client = new ImagizerClient({
  imagizerHost: 'media.example.imagizer.com',
});

const url = client.buildURL('https://cdn.example.com/assets/chair.png', {
  w: 800,
});

console.log(url);
// => 'https://media.example.imagizer.com/https%3A%2F%2Fcdn.example.com%2Fassets%2Fchair.png?w=800'

layers and layers64

The client JSON-serializes layers and layers64 automatically. Keys ending in 64 are base64url-encoded.

const url = client.buildURL('/products/chair.png', {
  layers64: [
    {
      url: '/watermarks/logo.png',
      pos: 'bottom|right',
      scale: 40,
    },
  ],
});

Development

pnpm format
pnpm lint
pnpm test
pnpm build

Reference

Imagizer API documentation: https://docs.imagizer.com/api_reference/