@josvar/image-resizer

0.3.0 • Public • Published

image-resizer

Latest Version on NPM Software License

Custom Cli for sharp image resizer

Install

You can install the package via yarn:

$ npm i @josvar/image-resizer

Usage

Create config file:

image-resizer init

Edit configuration file.

Resize images:

image-resizer resize -c [./images.config.js] -i [./input] -o [./output] -p [default]

Configuration

module.exports = {
  presets: {
    default: {
      sizes: [600, 400, 200],
      name: '[n]-[w][e]',
      jpeg: {
        quality: 50,
      },
    },
  },
}

Name tokens

  • n : filename without extension
  • b : filename
  • e : extension, eg .jpeg, .png
  • w : width (empty string if no present)
  • h : height (empty string if no present)

Sizes

  • width resize: [300, {w: 600}, 900, {w: 1200}, ...]
  • height resize: [{h: 300}, {h: 600}, ...]
  • aspect ratio resize: [{aspectRatio: '4:3', w: 600}, {aspectRatio: '5:2', w: 900}]

Jpeg Options

  • quality (default 85)
  • progressive (default true)
  • other sharp jpeg params

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please contact Josue Vargas instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.

Credits

Dependencies (6)

Dev Dependencies (8)

Package Sidebar

Install

npm i @josvar/image-resizer

Weekly Downloads

2

Version

0.3.0

License

MIT

Unpacked Size

10.9 kB

Total Files

8

Last publish

Collaborators

  • josvar