
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
TypeScript implementation of potrace - transforming bitmaps into vector graphics

A TypeScript implementation of Potrace — a tool for transforming bitmap images into scalable vector graphics.
| Original image | Potrace output | Posterized output |
|---|---|---|
![]() |
(Example image inherited from online demo of the browser version)
# Using npm
npm install ts-potrace
# Using Bun
bun install ts-potrace
# Using pnpm
pnpm add ts-potrace
# Using Yarn
yarn add ts-potrace
import fs from 'node:fs'
import { trace } from 'ts-potrace'
// Simple tracing with default options
trace('input.png', (err, svg) => {
if (err)
throw err
fs.writeFileSync('output.svg', svg)
})
// With custom options
trace('input.png', {
background: '#f8f9fa',
color: 'blue',
threshold: 120
}, (err, svg) => {
if (err)
throw err
fs.writeFileSync('output-custom.svg', svg)
})
import fs from 'node:fs'
import { posterize } from 'ts-potrace'
// Create multi-level color trace
posterize('input.png', {
steps: 5,
fillStrategy: 'dominant'
}, (err, svg) => {
if (err)
throw err
fs.writeFileSync('posterized.svg', svg)
})
// With custom threshold levels
posterize('input.png', {
steps: [40, 85, 135, 180]
}, (err, svg) => {
if (err)
throw err
fs.writeFileSync('custom-levels.svg', svg)
})
import fs from 'node:fs'
import { Potrace } from 'ts-potrace'
const potrace = new Potrace({
turdSize: 5,
alphaMax: 1,
optCurve: true,
optTolerance: 0.2
})
potrace.loadImage('input.png', (err) => {
if (err)
throw err
// Get full SVG document
const svg = potrace.getSVG()
fs.writeFileSync('output.svg', svg)
// Get just the path element
const path = potrace.getPathTag()
console.log(path)
// Get as SVG symbol with ID
const symbol = potrace.getSymbol('traced-image')
console.log(symbol)
})
import fs from 'node:fs'
import { Posterizer } from 'ts-potrace'
const posterizer = new Posterizer({
steps: 4,
fillStrategy: 'dominant',
rangeDistribution: 'auto',
background: '#ffffff'
})
posterizer.loadImage('input.png', (err) => {
if (err)
throw err
posterizer.setParameters({
color: '#333',
background: '#f0f0f0',
})
// Get the SVG with multiple color levels
const svg = posterizer.getSVG()
fs.writeFileSync('posterized.svg', svg)
// Get as SVG symbol with ID
const symbol = posterizer.getSymbol('posterized-image')
console.log(symbol)
})
'black', 'white', 'left', 'right', 'minority', 'majority''minority'21true0.20-255 or Potrace.THRESHOLD_AUTO for automatic threshold detectionPotrace.THRESHOLD_AUTOtrue'auto''transparent'Includes all Potrace parameters plus:
'dominant', 'mean', 'median', 'spread''dominant''auto', 'equal''auto'steps to 3turdSize to remove small detailsthreshold with a fixed value instead of automatic detectionnode-potrace - for the inspiration of this projectbun test
For more detailed documentation, examples, and API references, check out our documentation website.
Please see our releases page for more information on what has changed recently.
Please see CONTRIBUTING for details.
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
For casual chit-chat with others using this package:
Join the Stacks Discord Server
"Software that is free, but hopes for a postcard." We love receiving postcards from around the world showing where Stacks is being used! We showcase them on our website too.
Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎
We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.
The MIT License (MIT). Please see LICENSE for more information.
Made with 💙
FAQs
TypeScript implementation of potrace - transforming bitmaps into vector graphics
We found that ts-potrace demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.