Package Exports
- detect-edges
- detect-edges/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (detect-edges) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
detect-edges
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])
Name | Type | Default | Comment |
---|---|---|---|
canvas | HTMLCanvasElement |
required | Tainted canvas element |
options | Options |
see below |
options
Name | Type | Default | Comment |
---|---|---|---|
tolerance | Number |
0 |
Level 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