1.0.0 • Published 2 years ago

gulp-image-sanitizer v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

gulp-image-sanitizer

latest version on npm

Setup

npm install --save-dev gulp-image-sanitizer
const { src, dest } = require("gulp");
const imageSanitizer = require("gulp-image-sanitizer");

const images = () =>
  src("source/img/*")
    .pipe(
      imageSanitizer([
        {
          width: 640,
        },
      ])
    )
    .pipe(dest("public/img"));

module.exports.images = images;

Config

width

Type: number Default: undefined

Desired width of the image in pixels.

height

Type: number Default: undefined

Desired height of the image in pixels.

maxWidth

Type: number Default: undefined

Desired max width of the image in pixels. Smaller images are keep untouched.

maxHeight

Type: number Default: undefined

Desired max height of the image in pixels. Smaller images are keep untouched.

fit

Type: string Default: 'cover'

How the image should fit inside the specified dimensions.

position

Type: string Default: 'center'

What or where to focus on when cropping is necessary.

suffix

Type: string Default: undefined

String to prepend the file extension.