Socket
Socket
Sign inDemoInstall

crop-universal

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crop-universal

Crop transparent pixel from image


Version published
Weekly downloads
47
increased by17.5%
Maintainers
1
Weekly downloads
 
Created
Source

crop-universal

Package version Package size

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 more simple for you to use:

Installation

npm install crop-universal

Usage

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 canvas = cropper(url);

Documentation

crop(environment)

NameTypeDefaultComment
environmentObjectrequiredObject holding a createCanvas and a loadImage implementation

This will return a Function that you can use to crop.

crop(environment)(input, [options])

NameTypeDefaultComment
inputString|Image|HTMLImageElementrequiredPath to the image to process or any type supported by your Canvas.prototype.drawImage environment
optionsOptionsundefinedAllow to forward options to detect-edges

This will return a canvas with the result drawn onto.

License

MIT

Keywords

FAQs

Package last updated on 14 May 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc