imagemegustator
v1.0.1
Published
image processing toolkit
Downloads
6
Readme
Image Processing Toolkit
Overview
The Image Processing Toolkit is a Node.js package that provides simple yet powerful functionalities for image processing tasks such as resizing, cropping, and converting images to grayscale. This package leverages the Sharp library for efficient and high-quality image processing.
Installation
To install the Image Processing Toolkit package, you can use npm:
npm install image-processing-toolkit
Usage
Initializing the Toolkit
First, require the package and initialize the ImageProcessingToolkit
class with the path to your image file:
const ImageProcessingToolkit = require('image-processing-toolkit');
const imagePath = 'path/to/your/image.jpg';
const imageToolkit = new ImageProcessingToolkit(imagePath);
Resizing Images
You can resize images to a specified width and height using the resize
method:
const resizedImage = await imageToolkit.resize(300, 200);
Cropping Images
To crop images to a specific region, use the crop
method with the coordinates and dimensions of the desired crop area:
const croppedImage = await imageToolkit.crop(100, 100, 200, 150);
Converting Images to Grayscale
Convert images to grayscale using the grayscale
method:
const grayscaleImage = await imageToolkit.grayscale();
License
This package is licensed under the MIT License. See the LICENSE file for details.