🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

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

2.1.2
latest
Source
npm
Version published
Weekly downloads
4
33.33%
Maintainers
1
Weekly downloads
 
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

trim

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