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

pixmap-engine

v1.0.1

Published

On-device image similarity search

Readme

pixmap

Local image similarity search using CLIP embeddings, HNSW indexing, and SQLite. Everything runs on your machine — no cloud, no API keys, your images stay private.

Install

npm install pixmap-engine

Requires Node.js 18+. Native modules (sharp, better-sqlite3, hnswlib-node) compile during install.

Usage

Command Line

pixmap add ./photo.jpg            # index a single image
pixmap add ./photos/              # index a directory (recursive)
pixmap search ./query.jpg         # find similar images
pixmap search ./query.jpg -k 10   # return more results
pixmap list                       # show indexed images
pixmap status                     # index stats

Terminal View

As a library

import { PixmapEngine } from "pixmap-engine";

const engine = new PixmapEngine({ dataDir: "./data" });
await engine.init();

await engine.add("./photos/dog.jpg");
await engine.add("./photos/cat.png");

const results = await engine.search("./query.jpg", 5);

for (const r of results) {
  console.log(`${r.path} — ${(r.score * 100).toFixed(1)}%`);
}

Options:

  • -d, --data-dir <path> — where to store index and db (default: ./data)
  • -k, --top-k <n> — number of results (default: 5)

API

new PixmapEngine(options)

{
  dataDir: string;          // where to store index.hnsw and metadata.db
  indexFileName?: string;   // default: "index.hnsw"
  dbFileName?: string;      // default: "metadata.db"
}

Methods

  • **init()** — loads the CLIP model, opens or creates the HNSW index and SQLite db. Must be called before anything else.
  • **add(imagePath)** — indexes an image. Returns { id, skipped, record }. If the image was already indexed, skipped is true.
  • **search(imagePath, topK?)** — embeds the query image and returns the top-K most similar indexed images. Default K is 5.
  • **listImages(limit?)** — returns indexed images, newest first.
  • **getImage(id)** — look up a single image by its id.
  • **getIndexedCount()** — total number of indexed images.

How it works

Each image is resized to 224x224 with Sharp, run through a CLIP vision model (ViT-B/32, via ONNX), producing a 512-dimensional embedding vector. That vector goes into an HNSW index for fast nearest-neighbor lookup. File paths, IDs, and timestamps are tracked in a SQLite database.

Searching works the same way: embed the query image, ask HNSW for the closest vectors, look up the metadata.

See docs/HOW.md for the full technical breakdown.

What gets stored

Everything lives in your dataDir:

  • index.hnsw — the vector index (binary, hnswlib format)
  • metadata.db — SQLite database with image paths and metadata

About ~2KB per indexed image. A 100K image index is roughly 220MB.

Supported formats

JPEG, PNG, WebP, BMP, GIF, AVIF, TIFF — anything Sharp can read.

Dependencies

License

MIT