imagemin / imagemin-pngquant Goto Github PK
View Code? Open in Web Editor NEWImagemin plugin for `pngquant`
License: MIT License
Imagemin plugin for `pngquant`
License: MIT License
I'm getting the following error for certain png images:
at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:87:16)
(node:4546) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
This seems to be happening only on linux machines. I can't replicate this on a Mac because it uses a different binary.
I've also tried identifying the problematic image with ImageMagick, I'm not seeing anything odd on the output:
https://gist.github.com/geraldke/68f2e5f6480fdf18472286b73c01dfc3
Here's a test repo that can reproduce the error. Steps are on the readme, problematic image included.
https://github.com/geraldke/imagemin-pngquant-issue
It's odd that running the binary directly succeeds:
./node_modules/pngquant-bin/vendor/pngquant -- images/test.png
might be related to: #68
When I use yarn to install imagemin-pngquant, has error like this.
But I have executed brew install libpng
yet.
Command: node lib/install.js Arguments: Directory: /Users/lisw/Downloads/JOB/conan-episode-optimize/node_modules/pngquant-bin Output: ⚠ connect ECONNREFUSED 0.0.0.0:443 ⚠ pngquant pre-build test failed ℹ compiling from source ✖ Error: pngquant failed to build, make sure that libpng is installed at /Users/lisw/Downloads/JOB/conan-episode-optimize/node_modules/bin-build/node_modules/execa/index.js:231:11 at processTicksAndRejections (internal/process/task_queues.js:97:5) at async Promise.all (index 0)
Is it possible to add skip-if-larger option when sizes of images are smaller then pngquant returns? This option exists in cli mode, but we use pacel.js with parcel-plugin-imagemin plugin, and we are not able to send this parametr
But I have installed libpng
Running it with the following options:
// PngQuant
//floyd : 1,
nofs : false,
//posterize : ,
quality : 90,
speed : 1,
verbose : true,
and got the following (and similar) error(s) for all files. This is an example:
No errors detected while quantizing 1 image.
in file dev/assets/img/png/png8-interlaced_patroon.png
Warning: Error: stdin:
read 124KB file
made histogram...250 colors found
selecting colors...3%
selecting colors...15%
selecting colors...18%
selecting colors...30%
selecting colors...43%
selecting colors...45%
selecting colors...58%
selecting colors...71%
selecting colors...73%
selecting colors...86%
selecting colors...98%
selecting colors...100%
moving colormap towards local minimum
eliminated opaque tRNS-chunk entries...0 entries transparent
mapped image to new colors...MSE=2.400 (Q=91)
writing 143-color image to stdout
No errors detected while quantizing 1 image.
in file dev/assets/img/png/png8-interlaced_oog.png
Warning: Error: no writecb in Transform class in file dev/assets/img/png/png8-interlaced_streepjes.png
Warning: Error: no writecb in Transform class in file dev/assets/img/png/png8-interlaced_patroon.png
Warning: Error: no writecb in Transform class in file dev/assets/img/png/png8-interlaced_oog.png
Not a single file gets saved to the destination directory. I couldn't find any hint on why or even how that occurs. A search turned only up one IRC log for the AngularJS chat that leads nowhere.
The funny thing is, that grunt-contrib-imagemin
at the end states
Minified XX images
which didn't happen.
Edit: The images I'm using are from the Grunt ImageOptim CLI repos photoshop
(non optimized) example folder.
When using npm audit
it throws this:
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate │ Memory Exposure │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ tunnel-agent │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=0.6.0 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ imagemin-pngquant [dev] │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ imagemin-pngquant > pngquant-bin > bin-wrapper > download > │
│ │ caw > tunnel-agent │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://nodesecurity.io/advisories/598 │
└───────────────┴──────────────────────────────────────────────────────────────┘
This could most propably be resolved by updating the project packages
I'm getting the following error, when using with gulp-imagemin:
{ ArgumentError: Expected argument to be of type 'array' but received type 'number'
My gulp config:
$.imagemin(
[
imageminPngquant({
quality: 75
})
],
{
plugins: [
imageminPngquant
],
verbose: true
}
)
gulp 4.0.0
gulp-imagemin 5.0.3
imagemin-pngquant 7.0.0
Hi there,
I'm having some issues installing this module from behind a proxy. I've followed some online examples and set up my .npmrc to include the http and https proxy settings:
proxy=http://myproxy:port/
https-proxy=http://myproxy:port/
strict-ssl=false
ca=null
registry=http://registry.npmjs.org/
but I'm still getting the error when npm gets to the node lib/install.js stage.
Also, I have environment variable set up for HTTP_PROXY and HTTPS_PROXY on my machine too.
My setup is as follows:
OS: Windows 7 enterprise 64bit
NODE: v6.11.3
NPM: v3.10.10
I have no issues with this at home (no proxy).
Will you be able to help please?
Hello. I have this code
.then(() => {
imagemin([`./public/uploads/${'resize-' + req.body.file}`, `./public/uploads/${'greyscale-' + req.body.file}`], './public/uploads', {
plugins: [
mozjpeg({
quality: 80,
progressive: true
}),
pngquant({
quality: '65-80'
})
]
})
})
It comes after this
jimp.read(req.file.buffer)
.then((file) => {
file.resize(800, jimp.AUTO)
file.write(`./public/uploads/${'resize-' + req.body.file}`)
file.greyscale()
file.write(`./public/uploads/${'greyscale-' + req.body.file}`)
})
I don't know why pngquant
doesn't work, because mozjpeg
is working fine.
Hello, cannot compress screenshot I make in my app with toDataURL, it is silently returned failing isPng check. I tried to remove part of string before comma as well but have no effect. Will try to use file but really would be nice to be able to work with buffer.
Command npm audit
returned the following list of errors with high severity:
High Arbitrary File Write
Package decompress
Patched in No patch available
Dependency of imagemin-pngquant [dev]
Path imagemin-pngquant > pngquant-bin > bin-build > decompress
More info https://npmjs.com/advisories/1217
High Arbitrary File Write
Package decompress
Patched in No patch available
Dependency of imagemin-pngquant [dev]
Path imagemin-pngquant > pngquant-bin > bin-build > download >
decompress
More info https://npmjs.com/advisories/1217
Is there a chance to fix this problem?
pngquant supports an additional argument after passing the options, called [ncolors]
for setting the palette size. For advanced optimization, it would be useful to have this available as an option:
pngquant [options] [ncolors] -- pngfile [pngfile ...]
Use cases are black-and white illustrations, such as icons, drawings or line-art, where a palette of 256 colors does not bring any noticable increase in quality over a smaller palette of e.g. 16 or 32 colors.
I would propose to add an option called colors
or ncolors
to the plugin to make this option available in imagemin.
This package depends on execa
which sets the maxBuffer
option by default to 10 MB, unfortunately that causes this package to fail at processing images larger than 10 MB.
Please raise the maximum to Infinity
so any image can be processed.
Using the package in version 5.0.0 through gulp-imagemin throws following exception:
/srv/projects/pnquant-test/node_modules/stream-combiner2/node_modules/readable-stream/lib/_stream_readable.js:740
stream.on('end', function () {
^
TypeError: stream.on is not a function
at Readable.wrap (/srv/projects/pnquant-test/node_modules/stream-combiner2/node_modules/readable-stream/lib/_stream_readable.js:740:10)
at wrap (/srv/projects/pnquant-test/node_modules/stream-combiner2/index.js:67:29)
at combine (/srv/projects/pnquant-test/node_modules/stream-combiner2/index.js:29:18)
at Function.module.exports.obj (/srv/projects/pnquant-test/node_modules/stream-combiner2/index.js:22:10)
at Imagemin.createStream (/srv/projects/pnquant-test/node_modules/imagemin/index.js:103:24)
at Imagemin.run (/srv/projects/pnquant-test/node_modules/imagemin/index.js:77:20)
at DestroyableTransform.through.obj.percent (/srv/projects/pnquant-test/node_modules/gulp-imagemin/index.js:56:12)
at DestroyableTransform._transform (/srv/projects/pnquant-test/node_modules/through2-concurrent/through2-concurrent.js:29:15)
at DestroyableTransform.Transform._read (/srv/projects/pnquant-test/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:159:10)
at DestroyableTransform.Transform._write (/srv/projects/pnquant-test/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:147:83)
4.2.x still works though, any idea what I'm doing wrong?
Tested on node v5.11.0 with small package:
gulpfile.js
var gulp = require('gulp');
var imagemin = require('gulp-imagemin');
var pngquant = require('imagemin-pngquant');
gulp.task('default', function ()
{
return gulp.src('Src/**/*')
.pipe(imagemin({
optimizationLevel: 3,
progressive: true,
interlaced: true,
use: [pngquant()]
}))
.pipe(gulp.dest('Build'));
});
package.json
{
"name": "pnquant-test",
"version": "0.0.1",
"description": "",
"main": "gulpfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT",
"devDependencies": {
"gulp": "^3.9",
"gulp-imagemin": "^2.4",
"imagemin-pngquant": "^5.0"
}
}
Not counting a dummy png file.
Any further information necessary from my side?
Cheers for all the great packages!
I just updated from 4.1 to 4.2, and my optimization time has jumped about 10-fold.
Running via grunt-contrib-imagemin, and processing a lot of fairly large (2048x2048), images, using the following settings:
pngquant({ quality: '65-80', speed: 4 })
Reverting back to 4.1 seems to restore the performance.
Happening on Windows 10/7 and OSX.
Hi there,
I installed the above plugin and used it in my gulp task to minify images. works like a charm on my local machine. When I deploy the same code in production environment, I get the following issues. Please help...!!
/node_modules/pngquant-bin/vendor/pngquant` binary doesn't seem to work correctly
Error: pngquant failed to build, make sure that libpng-dev is installed
Do I have to add another npm like libpng-dev in my package.json?
The installation is prompted to depend on the components do not support node7.0 +
WARN node unsupported "[email protected]" is incompatible with [email protected] › [email protected] › [email protected] › [email protected] › got@^5.0.0, expected node@>=0.10.0 <7
There are already new versions of the components that need to be dependent. Can I update it?
Thank you.
The --verbose parameter causes some output on stderr (since stdout is being used for the new image) and the code stops when there is something written to stderr.
This should be handled a bit differently. If the verbose flag is present, the stderr data chunks should be concatenated and pushed to some sort of logging mechanism.
I would do this myself, but I'm unfamiliar with how the logging should be done in this case.
Hi there,
I have installed imagemin and imagemin-pngquant on my project and when I run "gulp" the following message come sup on the cmd:
module.js 327
throw err;
^
Error: Cannot find module 'imagemin
at Function.Module._resolveFilename module.js:325:15
at Function.Module._load module.js:353:17
at Module.require module.js:353:17
at require <internal/module.js:12:17>
at Object. <C:\User\user\Desktop\test7\guulfile.js:10:16>
at Module._compile module.js:409:26
at Object.Module._extensions..js module.js:416:10
at Module.load module.js:343:32
at Function.Module._load module.js:300:12
at Module.require module.js:353:17
So, my gulpfile.js is configurate as follow:
var gulp = require('gulp'),
jade = require ('gulp-jade');
data = require('gulp-data');
swig = require('gulp-swig');
sass = require('gulp-sass');
copy = require('gulp-contrib-copy');
uglify = require('gulp-uglify');
rename = require('gulp-rename');
compressor = require('gulp-compressor');
imagemin = require('imagemin');
imageminPngquant = require('imagemin-pngquant');
mozjpeg = require('mozjpeg');
// optimize images
gulp.task('imagemin', () => {
return gulp.src('templates/img/*')
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [ mozjpeg(), pngquant( {
quality: '20-70',
speed: 1
} ) ]
}))
.pipe(gulp.dest('builds/development/img/'));
});
imagemin(['templates/img/*.png'], 'builds/development/img/', {use: [imageminPngquant()]}).then(() => {
console.log('Images optimized');
});
........
gulp.task('default', ['templates', 'copy', 'compress', 'sass', 'css', 'html', 'copy1', 'imagemin'], function(){});
Is there any instructions missing on the npm page of the plugin or any missing config on my gulpfile.js?
Any help it will be great.
Kind regards,
Fernando Fas
pngquant supports quite a few options that alter the output quality. I've been hacking them into index.js
for the time being, but an options object would be nicer.
I'm using this plugin via Gulp (i.e. via Node), and I'm getting this error on CentOS 6:
/node_modules/imagemin-pngquant/node_modules/pngquant-bin/vendor/pngquant: /lib64/libc.so.6: version `GLIBC_2.14' not found
It works fine under Mac OS X but not in CentOS.
npm ERR! [email protected] postinstall: node lib/install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'node lib/install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the pngquant-bin package,
npm ERR! not with npm itself.
Since the release of v4.2.1 the following error is occuring:
/home/vagrant/www/node_modules/gulp-util/lib/PluginError.js:73
if (!this.message) throw new Error('Missing error message');
^
Error: Missing error message
at new PluginError (/home/vagrant/www/node_modules/gulp-util/lib/PluginError.js:73:28)
at DuplexWrapper.<anonymous> (/home/vagrant/www/node_modules/gulp-imagemin/index.js:58:8)
at emitOne (events.js:77:13)
at DuplexWrapper.emit (events.js:169:7)
at Through2.<anonymous> (/home/vagrant/www/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/stream-combiner2/node_modules/duplexer2/index.js:49:12)
at emitOne (events.js:82:20)
at Through2.emit (events.js:169:7)
at onwriteError (/home/vagrant/www/node_modules/imagemin-pngquant/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:347:10)
at onwrite (/home/vagrant/www/node_modules/imagemin-pngquant/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:365:5)
at WritableState.onwrite (/home/vagrant/www/node_modules/imagemin-pngquant/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:124:5)
PNG images outputted from node sharp are piped into pngquant for lossy and advanced optimisations.
An error occurs when the quality string for pngquant contains a too narrow range (e.g. '80-90'):
events.js:141
throw er; // Unhandled 'error' event
^
Error: Command failed: /home/user/test/node_modules/pngquant-bin/vendor/pngquant --output /tmp/06882c02-6fe8-41d9-b706-3e8ab3eb2f17 /tmp/13322606-798c-4f90-b540-e384134c9280 --quality 90-100 --speed 3
at /home/user/test/node_modules/execa/index.js:170:11
at process._tickCallback (node.js:385:9)
[...]
Gulp and the node process completely exits prematurely.
Edit: According to caught error, pngquant binary exited with code 99, which is described here: https://github.com/pornel/pngquant#--quality-min-max
This module should handle the error, emit an info or warning but not fail like it does currently.
I get this when installing on a Windows 7 32 bit machine.
node lib/install.js
‼ spawn ENOENT
‼ pngquant pre-build test failed
i compiling from source
× Error: pngquant failed to build, make sure that libpng-dev is installe
at ChildProcess.exithandler (child_process.js:648:15)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
[email protected] node_modules\imagemin-pngquant
├── [email protected]
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected])
Cheers,
Dave
Can you provide TypeScript type definition?
Sample from a sibling package.
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/imagemin-jpegtran/index.d.ts
Actually it's every value except for 0
events.js:85
throw er; // Unhandled 'error' event
^
Error: error: cannot open - for reading
at Socket.<anonymous> (/Users/message/www/jsapp/node_modules/imagemin-pngquant/index.js:59:14)
at Socket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Socket.Readable.push (_stream_readable.js:126:10)
at Pipe.onread (net.js:538:20)
kornelski/pngquant@21a9d9e#diff-04c6e90faac2675aa89e2176d2eec7d8R72
I discovered this module is not the same as pngquant use.
In pngquant I run commend-line:
.\pngquant.exe --quality 50-60 .\gaoqing.png --output .\gaoqing2.png
compress gaoqing.png from 4948 kb to 898 kb.
But I used offical example:
let imgBuffer = await imagemin([imgFile.path], '', {plugins: [img_pngquant({quality: '50-60'})]});
fs.writeFile(wtImgPath,imgBuffer[0].data, (err)=>{
console.log(err)
});
it just copy this png to an other png, file's size didn't reduce.
And, I try to adjust quality's value,.
When I setting quality: '5-10'
, It's working and compress gaoqing.png from 4948 kb to 692 kb!
I'm very happy, but I want to ask why ?
@kevva can you tell me more about 'quality' ? please, thanks very much.
Hi !
Is it possible to use an external executable of pngquant ? I'm trying to use this plugin but I'm facing a problem because the company in which I work doesn't allow any automatic downloads from github (only internal or npm repo) so it cannot found the exec file ...
Is there a way to use an existent build of pngquant (downloaded on the machine) or download it from another url that can be specified in the config ? This is possible in the grunt plugin but doesn't seem to be possible with this one ...
Thanks
It would be cool if instead of specifying a target quality, one could instead also specify a target size
This would possibly involve running multiple iterations of pngquant with different parameters automatically to get a result that does not exceed the target size.
When executing npm install --save imagemin-pngquant in powershell of windows 10,it turn up untar error C:\Users\Administrator\AppData\Roaming\npm-cache\imagemin-pngquant\4.2.0\package.tgz,how can i solve?
Hi, I faced the problem in this package through gulp-imagemin.
gulp.task('imagemin', function() {
return gulp.src('src/images/*.{png,jpeg,gif}')
.pipe(imagemin({
progressive: true,
svgoPlugins: [
{ removeViewBox: false },
{ cleanupIDs: false }
],
use: [pngquant()]
}))
.pipe(gulp.dest('public/images'));
});
I run gulp imagemin
, and then console outputs were as follows;
/myproject/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/readable-stream/lib/_stream_readable.js:740
stream.on('end', function () {
^
TypeError: stream.on is not a function
at Readable.wrap (/myproject/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/readable-stream/lib/_stream_readable.js:740:10)
at wrap (/myproject/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/stream-combiner2/index.js:67:29)
at combine (/myproject/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/stream-combiner2/index.js:29:18)
at Function.module.exports.obj (/myproject/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/stream-combiner2/index.js:22:10)
at Imagemin.createStream (/myproject/node_modules/gulp-imagemin/node_modules/imagemin/index.js:103:24)
at Imagemin.run (/myproject/node_modules/gulp-imagemin/node_modules/imagemin/index.js:77:20)
at DestroyableTransform.through.obj.percent (/myproject/node_modules/gulp-imagemin/index.js:56:12)
at DestroyableTransform._transform (/myproject/node_modules/gulp-imagemin/node_modules/through2-concurrent/through2-concurrent.js:29:15)
at DestroyableTransform.Transform._read (/myproject/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:159:10)
at DestroyableTransform.Transform._write (/myproject/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:147:83)
So, I decided to use the previous version (v4.2.2);
npm install --save-dev [email protected]
and then there were no problem.
Thanks.
I have this image http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2016/03/1458102922pEaSWms-1024x387.png
Code:
imagemin.buffer(buferImg, {
plugins: [
imageminPngquant({quality: '40-55'})
]
}).then(function(file){
console.log('Optimize img...: ');
})
With other png images this code works, but with this image the flux never end. The code stop and don't enter on .then.
the code work if i remove property quality, but i need this property. Anyone can help me why this img block my imagemin code.
Thanks.
i hava create an image compress tool base on electron , use imagemin-pngquant to compress png file , it is useful in electron develop mode,but there is an error when i build electron to a exe file ,
Error: Error in file: C:/Users/54657645/Desktop/images/5.png
at exports._errnoException (util.js:1024)
at Socket._writeGeneric (net.js:762)
at Socket._write (net.js:781)
at doWrite (_stream_writable.js:371)
at writeOrBuffer (_stream_writable.js:357)
at Socket.Writable.write (_stream_writable.js:274)
at Socket.write (net.js:699)
at Socket.Writable.end (_stream_writable.js:536)
at Socket.end (net.js:491)
at handleInput (C:\Users\54657645\AppData\Local\Programs\imagecompress\resources\app.asar\node_modules\imagemin-png…:89)
Using imagemin-pngquant
with gulp-imagemin
yields in a very, very long execution time. A small png image takes up to 35 seconds to optimize. (A pretty large image takes up to 3 minutes.) Running the same image directly via the included pngquant.exe
binary, the execution time feels right with about some hundred milliseconds at max.
This happens when using version 4.2.x and 4.1.x of imagemin-pngquant
.
I'm running an up-to-date Windows 10 64-bit and node 5.10.x.
Anything else I can provide?
I've seen this specific error on a few threads already, but, their fixes don't seem to help.
It seems to have a problem with a specific 24bit png file (3 other 24bit png files minify ok), if I remove the png, or, make the same png 8bit, it minifies ok.
I have just installed an xcode update, so many that has effected it somehow?
I have tried:
restarting macos,
restarting terminal,
deleting node_modules
then npm install
again
I noticed imagemin-pngquant uses pngquant-bin 3.0.0 so i tried getting the latest with npm install --save-dev pngquant-bin
though this doesn't work either, same error comes back.
Have you any suggestions?
Here is the error:
events.js:160
throw er; // Unhandled 'error' event
^
Error: Command failed: /Users/username/sites/site/node_modules/pngquant-bin/vendor/pngquant --output /var/folders/b5/qlvcks2d5j7c3l136tl9646m0000gn/T/cb38ae47-2d2c-4380-8bda-c4bf3eacfd13 /var/folders/b5/qlvcks2d5j7c3l136tl9646m0000gn/T/12c612f5-6612-4775-b4e4-829c6329b6a6 --quality 75-85
at Promise.all.then.arr (/Users/username/sites/site/node_modules/execa/index.js:201:11)
at process._tickCallback (internal/process/next_tick.js:103:7)
System details:
macOS 10.12.4
node v6.8.0
gulp cli 1.2.1
gulp local 3.9.1
TypeError: dest.on is not a function
at DestroyableTransform.Readable.pipe (/Users/AJ/dev/bz/lifesgreatestquestion.com/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:516:8)
at Gulp.<anonymous> (/Users/AJ/dev/bz/lifesgreatestquestion.com/gulpfile.js:256:6)
at module.exports (/Users/AJ/dev/bz/lifesgreatestquestion.com/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/Users/AJ/dev/bz/lifesgreatestquestion.com/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/Users/AJ/dev/bz/lifesgreatestquestion.com/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
at Gulp.Orchestrator.start (/Users/AJ/dev/bz/lifesgreatestquestion.com/node_modules/gulp/node_modules/orchestrator/index.js:134:8)
at /Users/AJ/npm/lib/node_modules/gulp/bin/gulp.js:129:20
at doNTCallback0 (node.js:415:9)
at process._tickCallback (node.js:344:13)
at Function.Module.runMain (module.js:474:11)
at startup (node.js:124:18)
at node.js:959:3
using io.js 2.0.1
npm install fails with pngquant failed to build, make sure that libpng is installed
.
This pngquant-bin issue describes the problem in the pngquant-bin dependency.
I am using v1.0.2. I assumed that since the arguments to pngquant include --skip-if-larger, that an image that failed to optimize because the outputted file was too large.
This is the output i get when using imagemin-pngquant through a grunt command, with verbose turned on.
Warning: Command failed: /var/folders/vk/vl8x2sx57mxg5skf6nr7lztn8r0910/T/25c835bd-fd08-418a-b752-ba5fd495cf45:
read 5KB file
made histogram...254 colors found
eliminated opaque tRNS-chunk entries...158 entries transparent
mapped image to new colors...MSE=0.000 (Q=100)
writing 254-color image as 7a701b63-b8c4-48c0-a770-ad3bb876fe05
file exceeded expected size of 4KB
writing truecolor image as 7a701b63-b8c4-48c0-a770-ad3bb876fe05
Skipped 1 file out of a total of 1 file.
Use --force to continue.
The call to the pngquant binary is returning an error code of 98, which is TOO_LARGE_FILE. Since we are skipping large files, this response should not be treated as an error.
For example, I have a lot of png files in a folder. How do I set the input directory and output directory?
Greetings. Want to report issue related to adding this packet to electron app, which then packed with asar. Asar detect executables and unpacked them in different dir, app.asar.unpacked, while pngquant still required from app.asar/node_modules resulting in that error.
Following this issue electron-userland/electron-builder#1120 managed to fix this using this packet https://github.com/epsitec-sa/hazardous. Namely went to imagemin-pngquant directory, executed npm i hazardous, then edited index.js following way:
'use strict'
require('hazardous');
const path = require('path');
...
let pngquant = require('pngquant-bin');
pngquant = path.join(pngquant,'');
Hello,
I'm using pngquant before uploading a file and when i use a file with a quality inferior of the pngquant options, i got an error Command failed
I used the verbose mode to see what's causing the error and i got
image degradation MSE=4.988 (Q=83) exceeded limit of 4.482 (85)
So i was thinking, is this normal, should it avoid throwing an error and ignore it?
_compress : (context) => {
return new Promise((fulfill, reject)=> {
if (/^image\/(jpg|jpeg|png)$/.test(context.type)) {
Imagemin.buffer(context.data, {
plugins : [
mozjpeg({
progressive : true,
quality : 70,
quantTable : 2
}),
pngquant({
quality : '85-100',
speed : 3
})
]
}).then(buffer => {
context.data = buffer;
fulfill(context)
}).catch(reject);
} else {
fulfill(context);
}
})
}
I'm getting this error using imageminPngquant:
errno: 'EPIPE', code: 'EPIPE', syscall: 'write', originalMessage: 'write EPIPE', shortMessage: 'Command failed with EPIPE:
And my code looks simply like this:
const imagemin = require('imagemin');
const imageminPngquant = require('imagemin-pngquant');
...
imagemin([filePath], {
destination: path.join('images/build'),
plugins: [
imageminPngquant()
]
})
.then(files => {
console.log(files);
})
.catch(err => {
console.log("Error compressing", err);
});
If I remove the imageminPngquant and leave the plugins section empty, the images do go to the destination properly but without any compression.
What could cause this issue? Any help would be greatly appreciated!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.