The main purpose of this utility is to recompress png files to get the smallest possible size
You probably want imagemin-advpng
instead.
$ npm install --save advpng-bin
import {execFile} from 'node:child_process';
import advpng from 'advpng-bin';
execFile(advpng, ['--recompress', '--shrink-extra', 'image.png'], error => {
console.log('Image minified!');
});
$ npm install --global advpng-bin
$ advpng --help