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

ngx-image-to-toon

v0.1.1

Published

Angular standalone component and service for cartoon, comic and painterly photo effects.

Readme

ngx-image-to-toon

npm bundle license

Angular bindings for image-to-toon — an injectable CaricatureService and the standalone <ngx-caricature-generator> component.

▶︎ Try it in the live playground →

Upload a photo, switch styles, drag the sliders, download the result. Everything runs in your browser — no upload, no account, no key.

npm i ngx-image-to-toon

Angular 16+ (standalone APIs and signals). Ships Ivy partial-compiled FESM2022 via ng-packagr.

Drop-in component

import { Component } from '@angular/core';
import { NgxCaricatureGeneratorComponent } from 'ngx-image-to-toon';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [NgxCaricatureGeneratorComponent],
  template: `
    <ngx-caricature-generator
      [config]="{ mode: 'grayscale', edgeStrength: 0.9 }"
      [autoProcess]="true"
      (processed)="onProcessed($event)"
      (failed)="onFailed($event)"
      (cleared)="onCleared()"
    />
  `,
})
export class AppComponent { /* … */ }

The sketch style and its sketch / pencil / marker presets are supported by the engine but not shown by default. Opt in with styles and presets — the allow-lists validate against everything the engine supports, not just what is shown.

Inputs: config, validation, driver, segmentation, autoProcess, showControls, showActions, showPresets, showBackground, showPreview, showFormatPicker, downloadFormat, downloadFileName, debounceMs. Same two-column layout as the React component: numbered step cards on the left, a sticky live-preview card on the right. Outputs: processed, failed, cleared. Projected content renders below the controls.

Restricting what the end user sees

presets, styles, backgrounds, modes, sliders and formats each take a subset. Omit an input and you get everything; supply one and only those render, in the order you give. Unknown values are dropped rather than rendered. A single-entry modes or styles hides that control entirely.

<ngx-caricature-generator
  [presets]="['cartoon', 'sketch']"
  [styles]="['cartoon', 'sketch']"
  [backgrounds]="['original', 'blur']"
  [modes]="['color']"
  [sliders]="['edgeStrength', 'smoothness']"
  [formats]="['png']"
/>

presets also takes your own definitions — a partial config with a name, mixed freely with built-in names:

readonly presets = [
  'cartoon',
  'comic',
  { name: 'vintage', label: 'Vintage', config: { style: 'painting', saturation: 0.55, contrast: 1.25 } },
  { name: 'bold-comic', label: 'Bold comic', config: { ...PRESETS.comic, edgeThickness: 3 } },
];

Styling is driven by custom properties on the host, so a single rule restyles the widget:

ngx-caricature-generator {
  --itt-accent: #14b8a6;
  --itt-border: rgba(0, 0, 0, 0.15);
  --itt-radius: 8px;
}

Service

@Component({
  standalone: true,
  imports: [CommonModule],
  providers: [CaricatureService],           // component-scoped instance
  template: `
    <input type="file" (change)="onFile($event)" />
    <img *ngIf="toon.resultUrl() as url" [src]="url" alt="Caricature" />
    <p *ngIf="toon.state().isProcessing">{{ toon.state().progress * 100 | number: '1.0-0' }}%</p>
  `,
})
export class ToonifyComponent {
  readonly toon = inject(CaricatureService);

  onFile(event: Event) {
    const file = (event.target as HTMLInputElement).files?.[0];
    if (file) this.toon.process(file);
  }
}

State is available as a signal (toon.state(), toon.sourceUrl(), toon.resultUrl()) and as an observable (toon.state$), so it works in zoneless signal apps and classic RxJS apps alike.

Methods: process(), load(), reset(), cancel(), setMode(), setStyle(), setBackground(), applyPreset(), setSegmentation(), updateConfig(), resetConfig(), setDriver(), configure(), downloadImage(), getBlob(), getBase64(), getCanvasElement(), toFormData(), toJSON(), and instance for the raw engine.

this.toon.applyPreset('marker');                          // bold line art
this.toon.setStyle('painting');
this.toon.setBackground('solid', { backgroundColor: '#f0b429' });
this.toon.setSegmentation(createMediaPipeSegmentation()); // pixel-accurate cutouts

Omit the providers array to share the root singleton across your app instead.

Full API reference: https://github.com/mamta-epili/image-to-toon#readme

License

MIT