1.1.1 • Published 1 year ago

detect-edges v1.1.1

Weekly downloads
7
License
MIT
Repository
github
Last release
1 year ago

detect-edges

Package version Package size

Smartly detect edges of an image.

Installation

npm install detect-edges

Usage

import detect from "detect-edges";

// Browser
const canvas = document.createElement("canvas");

// Node
import Canvas from "canvas";
const canvas = Canvas.createCanvas(800, 600);

const context = canvas.getContext("2d");
// Edit the canvas' context
// ...

const { left, top, right, bottom } = detect(canvas);

Documentation

detect(canvas, [options])

NameTypeDefaultComment
canvasHTMLCanvasElementrequiredTainted canvas element
optionsOptionssee below

options

NameTypeDefaultComment
toleranceNumber0Level of tolerance for the transparency between 0 and 1 (0 mean no tolerance, 1 mean everything is treated as transparent)

Related

  • If you want to crop an image in Node.js, use crop-node
  • If you want to crop an image using your terminal, use crop-node-cli
  • If you want to crop an image in the browser, use crop-browser

License

MIT