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

@chakata/pichax

v0.0.6-beta

Published

Generate signed URLs for on-the-fly image transformations

Readme

📸 PichaX SDK (Node.js)

The official Node.js SDK for interacting with the PichaX image transformation and identicon generation service.

Generate signed, expirable image URLs for transformations such as rotate, resize, flip, and identicons — fast, secure, and simple.


🚀 Installation

npm install @chakata/pichax
# or
yarn add pichax

Example

import { PichaX } from '@chakata/pichax';

const picha = new PichaX('your_api_key', 'your_api_secret');


// 🔁 Transform an image
const transformUrl = picha.transform({
  id: 'img_123',
  expires: '1725168000', // Unix timestamp
  src: 'https://example.com/image.jpg',
  cache: false, // Not required. Default: true
  params: {
    "rotate": {"degrees": 45},
    "resize": {"w": 100, "h": 200, "mode": "fill"}, // Modes: "fit", "fill", "crop"
    // Resize options:
    // {"scale": 0.5} -- This will scale image to 50% of the original size
    // {"w": 100} -- This will keep aspect ratio
    "effects": [{"grayscale": true}, {"blur": 10}, {"sharpen": true}],
    "format": "jpeg", // Options are: "webp", "jpeg", "png"
    "quality": 80, // 0 - 100
    "watermark": {"text": "Hello there"},
    // custom watermarks are only supported in production key
    // a default watermark is applied otherwise
    "crop": {"x": 100,"y": 30,"w": 100,"h": 20}
    // Crop options:
    // {"w": 100, "h", 200, "mode": "centre"} -- Modes: "centre", "attention", "entropy"
  }
}).getUrl();

console.log(transformUrl);

// 👤 Generate an identicon
const identiconUrl = picha.identicon({
  id: 'user_123',
  expires: '1725168000',
  name: 'PichaX'
}).getUrl();

console.log(identiconUrl);

🔐 Signature Generation

All URLs include a signature for security, generated using HMAC-SHA256:

HMAC_SHA256(unique_key + ":" + expires, api_secret)

🧰 Transformations

Each transformation is optional and can be combined:

params: {
  rotate: { degrees: 90 },              // 0 - 360
  resize: { scale: 0.5 },               // 0 < scale <= 1
  flip: { direction: 'horizontal' },    // 'horizontal' | 'vertical'
  grayscale: true,
  crop: {x: 100, y: 100, w: 200, h: 300}, // x and y are optional and will default to 0
  // crop: { type: "frontal_face" } Uses AI to detect front looking face
}

Crop

crop is a bit special. If { type: 'frontal_face' } is used, PichaX uses AI to detect a frontal looking face and crops by it. This feature is experimental and we are improving it every day.

✅ Type Safety

This SDK is written in TypeScript and includes full type definitions out of the box.

Testing

npm test

🌐 Learn More

For full API documentation, visit Docs