New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

batch-image-resizer

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

batch-image-resizer

CLI tool for resizing and optimising images.

  • 0.0.1
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Batch image resizer

npm version dependencies devDependencies

CLI tool for resizing images using sharp and optimising jpg and png files using imagemin. The CLI tool does not require imagemagick or graphicsmagick to be installed.

Supports both single files as well as recursive file finding and processing using a glob pattern.

Installation

$ npm install

Example

Using -s flag followed by an array of numbers one can specify the image sizes wants to resize their image to.

These sizes can be passed to a glob where all compatible files in a nested folder structure are found and converted to the specified formats. The folder structure of the input folder is retained in the output folder.

$ node ./bin/batch-image-resizer.js -i ./input -o ./output -s "[50, 500, 1000, 1500]"

Alternatively one can specify a single file to convert

$ node ./bin/batch-image-resizer.js -i ./input/example.png -o ./output/example.png -s "[50, 500, 1000, 1500]"

Which in turn creates

input
└── example.jpg

output
├── example-1000w.jpg
├── example-1500w.jpg
├── example-500w.jpg
└── example-50w.jpg

Flags

Default

-v, --version [print version number]
-h, --help [print help]

Required

-i, --input [example: -i ./input/example.png] [example: -i ./input] [required]
-o, --output [example: -o ./output/example.png] [example: -o ./output] [required]

Optional

-s, --sizes [example: -s "[50, 500, 1000, 1500]"] [not required]

Formats

<img
	alt="Example image description"
	srcset="example-500w.jpg 500w, example-1000w.jpg 1000w, example-1500w.jpg 1500w"
	src="example-1000w.jpg"
/>

<picture>
	<source srcset="example-500w.webp 500w, example-1000w.webp 1000w, example-1500w.webp 1500w" type="image/webp">
	<source srcset="example-500w.jpg 500w, example-1000w.jpg 1000w, example-1500w.jpg 1500w" type="image/jpeg">
	<img src="example-500w.jpg" alt="Example image description">
</picture>

Licence

My work is released under the MIT license.

FAQs

Package last updated on 02 Mar 2018

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