crop-browser
Crop all transparent pixel around an image's edges.
Installation
npm install crop-browser
Usage
; // Path to an image fileconst path = "path/to/image.png";const options = outputFormat: "png";// Run the async function and display the resultasync { const cropped = await ; // Display the file (for example) documentbody;};
Documentation
crop(input, [options])
Name | Type | Default | Comment |
---|---|---|---|
input | String\|any |
required | Path to the image to process or any type supported by Canvas.prototype.drawImage |
options | Options |
(see below) | Some options |
options
Name | Type | Default | Comment |
---|---|---|---|
outputFormat | String |
"png" |
Format of the output image ("png" or "jpeg" ) |
In addition, all options of detect-edges
are supported.
Related
- Only want to detect content edges, see
detect-edges
- For the nodeJS version see
crop-node
- For a CLI version see
crop-node-cli