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

@alpaka-studio/photo-scaler

v0.0.10

Published

Automatic photo-scaler using sharp to provide breakpoint'ed images to speed-up development and page loads

Readme

PhotoScaler

PhotoScaler is node.js library based on sharp to automate scaliing and transforming images for better site responsivnes. Easily scale-down images to many other formats and provide fallback formats for older browser. Package can offer also exporting map of image paths to it's dimensions and other info to provide easier calculating image width and height.

First steps

Install photo-scaler

npm install photo-scaler

Now we have to create our first configuration for photo-scaler

// photo-scaler.config.json
{
  // version of configuration
  "version": "1.0.0",
  // change it's current working directory
  // setting "./" will change cwd to directory where config lives
  "cwd": "./",
  // this is where fun begins
  "assets": {
    // globaly provided extensions, can be overwritten inside
    // configurations
    "extensions": {
      "images": {
        "primary": "webp",
        "fallback": "png"
      },
      "videos": {
        "primary": "webp",
        "fallback": "mp4"
      }
    },
    // this is optional extractor for all collected images
    // if it's set, photo-scaler will save all extracted images
    // into map of path to information about image and generate file
    "metadataExtraction": {
      "type": "angular",
      "outputPath": "../app/photo-scaler-metadata.injector.ts",
      "trimPathsTo": "../",
      // setting it's value to true will cause to cut path to just file name
      // e.g. assets/images/photo1.png to photo1.png
      "fileNamesOnly": false
    },
    // this is where all configurations lives in
    "configurations": [
      {
        // give it a name, so later on it could be easier
        // to identify where it fails or anything
        "name": "actor",
        // default scale width for all breakpoint'ed images
        // for example if we take breakpoint xs which is 575
        // it will multiply by 60% so in a result we will receive
        // 345 px width, this can be overwritten by providing `targetWidth` or `targetHeight` value
        // at specific breakpoint
        "defaultScaleWidth": "60%",
        "breakpoints": [
          {
            "prefix": "xs",
            "width": 575
          },
          {
            "prefix": "sm",
            "width": 767
          },
          {
            "prefix": "md",
            "width": 991
          },
          {
            "prefix": "lg",
            "width": 1199
          },
          {
            "prefix": "xxl",
            // do not rescale photo, just prefix it.
            "keepOriginalSize": true
          }
        ],
        // path where the images can be found
        // it can be path to specific image or to directory of images
        // in case of directory, it will recursevily go through
        // all of the nested directories
        "path": "./images"
      }
    ]
  }
}