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

imgtor

v5.1.0

Published

Extensible image editing tool via HTML canvas (ImgTor fork)

Readme

ImgTor

License MIT CI

ImgTor is a maintained canvas image editor, hosted at github.com/ai-tonia/imgtorjs. The npm package name is imgtor. This line modernizes the build (Vite + Lightning CSS for styles), targets Node.js 22+, and exposes the editor as global imgtor (constructor).

Install from npm

npm install imgtor

The package ships build/imgtor.js and build/imgtor.css. The editor is Canvas 2D (HTML <canvas>).

Optional toolbar plugins (filter, finetune, resize, frame, fill, redact, annotate, decorate, retouch) are loaded with the bundle but disabled by default in the demo. Enable them with plugins: { filter: {}, … } or turn them off explicitly with plugins: { filter: false }.

TypeScript: ambient types live in types/imgtor.d.ts. Use /// <reference types="imgtor" /> (or include that file); the global imgtor constructor is declared there.

Upstream history: DarkroomJS by Matthieu Moquet. Thank you, Matthieu — your original library was the icebreaker that made browser-side canvas editing approachable for so many of us; ImgTor exists to carry that idea forward with a modern toolchain.

What changed in this fork

  • Name: ImgTor (npm package imgtor, repository ai-tonia/imgtorjs). Use global imgtor in application code.
  • Build: Vite (IIFE bundle) and Lightning CSS minify lib/css/imgtor.cssbuild/imgtor.css (no Dart Sass).
  • Tooling: ESLint, Prettier, and Vitest smoke tests (npm test).
  • Demo: third-party analytics were removed from the sample page.

⚠️ Upstream notice (historical)

The original project this line descends from is discontinued and no longer maintained by the original author. ImgTor carries the codebase forward with a modern toolchain and tests.

Requirements

  • Node.js 22+ and npm

Building

npm install
npm run build

The published npm tarball includes build/imgtor.js and build/imgtor.css (package.json files, main, style). npm publish runs prepublishOnlynpm run build first.

Built files go to build/ (not committed). The demo loads ./build/... under demo/, so npm start runs npm run build, copies build/ into demo/build/ (npm run sync:demo), then serves the demo on port 2222.

  • npm start — build, sync demo assets, serve demo/ on port 2222
  • npm run develop — watch JS (Vite) and CSS (parallel watchers; stop with Ctrl+C)

Usage

Instantiate the editor with a reference to the image element:

<img src="some-image.jpg" id="target" />
<script src="path/to/build/imgtor.js"></script>
<script>
  new imgtor('#target');
</script>

You can also pass options:

new imgtor('#target', {
  minWidth: 100,
  minHeight: 100,
  maxWidth: 500,
  maxHeight: 500,
  plugins: {
    crop: {
      minHeight: 50,
      minWidth: 50,
      ratio: 1,
    },
    save: false,
  },
  initialize: function () {
    this.plugins['crop'].requireFocus();
    this.addEventListener('core:transformation', function () {
      /* ... */
    });
  },
});

Why?

It's easy to get a JavaScript snippet to crop an image on a page. If you want rotation or more canvas work, you often build it yourself. This library uses HTML5 canvas (Canvas 2D) without jQuery.

The concept

The core turns the target image into canvas surfaces and an empty toolbar. Features live in plugins; each plugin can add toolbar buttons and behavior.

Contributing

See CONTRIBUTING.md for layout, tests, and workflow.

npm run develop

Run checks:

npm test
npm run test:e2e
npm run lint

See RELEASING.md for publish steps and SECURITY.md to report vulnerabilities.

FAQ

How can I access the edited image?

Ask the canvas for data inside your save callback (or another hook):

save: {
  callback: function () {
    this.imgtor.selfDestroy();
    const newImage = this.imgtor.canvas.toDataURL();
    fileStorageLocation = newImage;
  },
},

License

Released under the MIT License. See LICENSE.