Socket
Socket
Sign inDemoInstall

crop-browser

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crop-browser

Crop transparent pixel from image in the browser


Version published
Weekly downloads
11
decreased by-8.33%
Maintainers
1
Weekly downloads
 
Created
Source

crop-browser

Package version Package size

Crop all transparent pixel around an image's edges.

Installation

NPM

You'll then need to bundle your code with a bundler.

npm install crop-browser

CDN

You don't need installation, just import from a CDN.

Usage

// 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);
})();

Documentation

crop(input, [options])

NameTypeDefaultComment
inputString|anyrequiredPath to the image to process or any type supported by Canvas.prototype.drawImage
optionsOptions(see below)Some options

options

NameTypeDefaultComment
outputFormatString"png"Format of the output image ("png" or "jpeg")

In addition, all options of detect-edges are supported.

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