imagecompressionutility13

1.0.1 • Public • Published

Image Compression Utility

A lightweight Node.js utility for compressing images using the Sharp library.

Installation

You can install the utility via npm:

npm install image-compression-utility

Usage

const compressImage = require('image-compression-utility');

// Example usage
const inputPath = 'input.jpg';
const outputPath = 'output.jpg';
const options = {
    quality: 80,
    maxWidth: 1024,
    maxHeight: 768
};

// Compress the image
compressImage(inputPath, outputPath, options);

API

compressImage(inputPath, outputPath, options)

Compresses an image using the Sharp library.

  • inputPath: The file path of the original image.
  • outputPath: The file path where the compressed image will be saved.
  • options (optional): An object containing compression options. Available options are:
    • quality: The quality of the compressed image (default: 80).
    • maxWidth: The maximum width of the compressed image (default: 1024).
    • maxHeight: The maximum height of the compressed image (default: 768).

License

This project is licensed under the MIT License - see the LICENSE file for details.

Readme

Keywords

none

Package Sidebar

Install

npm i imagecompressionutility13

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

2.53 kB

Total Files

3

Last publish

Collaborators

  • oskar13