Socket
Socket
Sign inDemoInstall

crop-node

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crop-node

Crop transparent pixel from image in Node.js


Version published
Maintainers
1
Created
Source

crop-node

Package version Package size

Crop all transparent pixel around an image's edges. (CLI version)

Installation

npm install crop-node

Usage

import crop from "crop-node";
import { writeFileSync } from "fs";

// Path to an image file
const path = "path/to/image.png";
const options = {
    outputFormat: "png",
};
// Run the async function and write the result
(async () => {
    const cropped = await crop(path, options);
    // Write the file (for example)
    writeFileSync("cropped.png", 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