1.1.0 • Published 11 months ago

imgpress v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

imgpress - Image Compressor

Description

This is a simple image compressor that uses the sharp package to compress images.

Global Installation & Usage

Installation cli (globally)

npm i -g imgpress

Compressing a single image from cli

imgpress s -i <input> -o <output> -q <quality> -w <width> -h <height> -p <webp compression for png files>

If no output is specified, the output will be OriginalFile_processed.ext

Compressing multiple images in a directory from cli

imgpress f -i <input-directory> -o <output-directory> -q <quality> -w <width> -h <height> -p <webp compression for png files>

If no output directory is specified, the output directory will be "_processed" in the input directory.

Project Installation & Usage

Project-level Installation

npm i imgpress

Compressing a single image in node project

import { Compressor } from 'imgpress';

await Compressor.imageCompress('./original.jpg', './processed.jpg', {
  quality: 80, //default is 80
  maxWidth: 1000, //default is 1000
  maxHeight: 1000, //default is 1000
  pngToWebp: false // default is false, only works for png files
});

Compressing multiple images in a directory in node project

import { Compressor } from 'imgpress';

await Compressor.folderCompress('./originals', './processed', {
  quality: 80, //default is 80
  maxWidth: 1000, //default is 1000
  maxHeight: 1000, //default is 1000
  extensions: ['jpg', 'png', 'jpeg'], //default is ['jpg', 'png', 'jpeg'], images to process by extension
  pngToWebp: false // default is false, only works for png files
});
1.1.0

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago

0.0.11

11 months ago

0.0.10

11 months ago

0.0.9

11 months ago

0.0.7

11 months ago

0.0.6

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago