Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@doodle3d/potrace-js

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@doodle3d/potrace-js

Traces bitmap images to vector paths


Version published
Maintainers
2
Created
Source

POTRACE

Based on http://potrace.sourceforge.net and https://github.com/kilobtye/potrace.

Converts bitmap images to vector paths.

Usage

Using JSPM (ECMAScript / ES6 Module)

Install the library.

jspm install POTRACE=github:casperlamboo/POTRACE

Include the library.

import POTRACE from 'POTRACE';

Using NPM (CommonJS module)

Install the library.

npm install potrace-js

Include the library.

var POTRACE = require('potrace-js');

API

Options

{
  turnpolicy: enum('black' | 'white' | 'left' | 'right' | 'minority' | 'majority'),
  turdsize: Float,
  optcurve: Bool,
  alphamax: Float,
  opttolerance: Float
}
  • turnpolicy: how to resolve ambiguities in path decomposition. (default: "minority")
  • turdsize: suppress speckles of up to this size (default: 2)
  • optcurve: turn on/off curve optimization (default: true)
  • alphamax: corner threshold parameter (default: 1)
  • opttolerance: curve optimization tolerance (default: 0.2)

POTRACE.traceUrl

Traces a given image from url.

[...Path] = async POTRACE.traceUrl(url: String, [ options: Object ])
  • url: path to the image
  • options: trace options

POTRACE.traceImage

Traces a given image.

[...Path] = POTRACE.traceImage(image: HTMLImageElement, [ options: Object ])
  • image: image containing the image
  • options: trace options

POTRACE.traceCanvas

Traces a given canvas.

[...Path] = POTRACE.traceCanvas(canvas: HTMLCanvasElement, [ options: Object ])
  • canvas: canvas containing the image
  • options: trace options

POTRACE.bitmap

Traces a given bitmap.

[...Path] = POTRACE.traceBitmap(bitmap: POTRACE.Bitmap, [ options: Object ])
- bitmap: bitmap containing image info (1 and 0 values)
- options: trace options

POTRACE.getSVG

Converts trace result to svg.

svg: String = POTRACE.getSVG([...Path])

POTRACE.getPaths

Converts trace result to readable paths.

svg: String = POTRACE.getPaths([...Path])

FAQs

Package last updated on 18 Jul 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc