@josvar/image-resizer

Image resizer

Stats

StarsIssuesVersionUpdatedCreatedSize
@josvar/image-resizer
1130.3.02 years ago3 years agoMinified + gzip package size for @josvar/image-resizer in KB

Readme

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

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.