Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
crop-browser
Advanced tools
Crop all transparent pixel around an image's edges.
You'll then need to bundle your code with a bundler.
npm install crop-browser
You don't need installation, just import from a CDN.
// With NPM
import crop from "crop-browser";
// Or simply use directly
import crop from "https://www.unpkg.com/crop-browser";
// Run the async function and display the result
(async () => {
const cropped = await crop("path/to/image.png");
// Display the file (for example)
document.body.appendChild(cropped);
})();
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.
detect-edges
crop-node
crop-node-cli
FAQs
Crop transparent pixel from image in the browser
The npm package crop-browser receives a total of 10 weekly downloads. As such, crop-browser popularity was classified as not popular.
We found that crop-browser 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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.