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
Maintainers
1
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 way 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 options = {
    outputFormat: "png",
};
const canvas = cropper(url, options);

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
input`Stringany`required
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 29 Jan 2020

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