### Install esm-potrace-wasm Source: https://github.com/tomayac/esm-potrace-wasm/blob/main/README.md Install the library using npm. This command adds the package as a project dependency. ```bash npm install --save esm-potrace-wasm ``` -------------------------------- ### Initialize and Use Potrace Wasm Source: https://github.com/tomayac/esm-potrace-wasm/blob/main/README.md Import and initialize the potrace module, then use it to vectorize an image. The `init()` function must be called once before using `potrace()`. The `potrace` function accepts an `ImageBitmapSource` and optional configuration options. ```javascript import { potrace, init } from 'esm-potrace-wasm'; (async () => { // Initialize the module once. await init(); /** * The `imageBitmapSource` parameter is an `ImageBitmapSource`, that is any of: * - `HTMLImageElement` * - `SVGImageElement` * - `HTMLVideoElement` * - `HTMLCanvasElement` * - `ImageData` * - `ImageBitmap` * - `Blob` */ const svg = await potrace( imageBitmapSource, (options = { turdsize: 2, turnpolicy: 4, alphamax: 1, opticurve: 1, opttolerance: 0.2, pathonly: false, extractcolors: true, posterizelevel: 2, // [1, 255] posterizationalgorithm: 0, // 0: simple, 1: interpolation }) ); })(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.