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-universal
Advanced tools
Crop all transparent pixel around an image's edges.
⚠️ This package is environment agnostic. It requires you to provide a Canvas
implementation. It'll be way more simple for you to use:
crop-browser
crop-node
crop-node-cli
npm install crop-universal
import crop from "crop-universal";
// You're in charge of providing a couple of function corresponding to your environment
const cropper = crop({createCanvas, loadImage});
const url = "path/to/file.png";
const options = {
outputFormat: "png",
};
const canvas = cropper(url, options);
crop(environment)
Name | Type | Default | Comment |
---|---|---|---|
environment | Object | required | Object holding a createCanvas and a loadImage implementation |
This will return a Function that you can use to crop. |
crop(environment)(input, [options])
Name | Type | Default | Comment |
---|---|---|---|
input | `String | any` | required |
options | Options | undefined | Allow to forward options to detect-edges |
This will return a canvas with the result drawn onto. |
FAQs
Crop transparent pixel from image
We found that crop-universal 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.