0

Trying to get imagemin to work in Nodejs. This is my code:

var imagemin = require('imagemin');
var imageminPngquant = require('imagemin-pngquant');
var PNGImages = ['images/image1.png', 'images/image2.png'];

imagemin(PNGImages, 'build', {
    plugins: [
        imageminPngquant({
            quality: '65-80'
        })
    ]
});

But I keep getting the error:

(node:22744) UnhandledPromiseRejectionWarning: ArgumentError: Expected argument to be of type `array` but received type `string`

What am I doing wrong? Thanks.

Strontium_99
  • 1,771
  • 6
  • 31
  • 52

2 Answers2

1

Found the answer.
imageminPngquant was throwing the error due to the 65-80 in the quality setting and not because of the PNGImages array.

:)

Strontium_99
  • 1,771
  • 6
  • 31
  • 52
0

Pass Quality as below

imageminPngquant({
            quality: [65, 80]
        })
user8115627
  • 108
  • 8