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

veronica

v0.3.1

Published

Library for manipulating images

Readme

Veronica

Veronica is an image manipulation library built on top of sharp, providing easy resizing, cropping, and format conversion with built-in caching support.

Features

  • Fast image resizing with aspect ratio preservation
  • Smart cropping using smartcrop
  • Native WebP, AVIF, PNG, JPEG, and GIF support
  • Built-in image caching
  • Placeholder image generation
  • Auto-orientation based on EXIF data
  • Cross-platform (macOS, Linux, Windows)

Requirements

No external binaries required! Sharp comes with pre-built binaries for all major platforms.

For placeholder generation, you'll need the canvas dependencies:

# Debian/Ubuntu
sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev

# macOS
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman

# Arch Linux
sudo pacman -S cairo pango giflib libjpeg-turbo librsvg

Installation

npm install veronica

Basic Usage

const Veronica = require('veronica');
const veronica = new Veronica({
    cache: '/tmp/veronica-cache'
});

const resizeOptions = {
    width: 400,
    height: 400,
    gravity: 'Center', // Or 'smartcrop' for automatic smart cropping
    quality: 80,
    type: 'webp' // Optional: output as WebP
};

// Resize the image and store it in the cache folder
veronica.getResizedImage('/path/to/original/image.jpg', resizeOptions, function(err, resizedPath) {
    // resizedPath contains the path to the cached resized image
});

API

new Veronica(options)

Create a new Veronica instance.

  • options.cache - Directory for cached files (default: /tmp/veronica-cache)

veronica.image(filePath)

Returns a VeronicaImage instance for the given file path.

const image = veronica.image('/path/to/image.jpg');

// Get image dimensions
image.size((err, size) => {
    console.log(size.width, size.height);
});

veronica.resize(filePath, options, callback)

Resize an image with the given options.

Options:

  • width - Target width
  • height - Target height
  • maxWidth - Maximum width (maintains aspect ratio)
  • maxHeight - Maximum height (maintains aspect ratio)
  • gravity - Crop gravity: 'Center', 'North', 'South', 'East', 'West', or 'smartcrop'
  • quality - Output quality 1-100 (default: 80)
  • type - Output format: 'webp', 'jpeg', 'png', etc.
  • target - Output file path
  • auto_orient - Auto-rotate based on EXIF (default: true)

veronica.getResizedImage(filePath, options, callback)

Same as resize(), but with automatic caching. Returns cached version if available.

veronica.convertToWebp(filePath, options, callback)

Convert an image to WebP format.

Options:

  • quality - Output quality 1-100 (default: 80)
  • target - Output file path

veronica.placeholder(options, callback)

Generate a placeholder image.

Options:

  • width - Width in pixels (default: 100)
  • height - Height in pixels (default: 100)
  • text - Custom text (default: "WxH")
  • backgroundStyle - Background color (default: '#CCC')
  • textStyle - Text color (default: '#FFF')
  • fontFamily - Font family (default: 'Impact')
  • dpr - Device pixel ratio multiplier

Migrating from v0.2.x

Version 0.3.0 replaced GraphicsMagick (gm) with sharp. The API remains the same, but:

  • No need to install GraphicsMagick or cwebp
  • Significantly faster processing
  • Native WebP support without external binaries
  • Requires Node.js >= 18.17.0

Note: The callback-based API is maintained for backwards compatibility. While sharp uses Promises internally, veronica continues to use callbacks to ensure existing code works without modification for now.

License

MIT