JamieMason / ImageOptim-CLI

Make optimisation of images part of your automated build process
https://foldleft.io/image-tools
MIT License
3.46k stars 126 forks source link

Command failed with exit code when using ImageAlpha (works great without it) #182

Closed rc042 closed 5 years ago

rc042 commented 5 years ago

Hi!

I meet an issue and I don't know how to solve it...

Steps To Reproduce The Error

Try to process a file or multiple file, for example:

$ imageoptim -a EXP_IMG_893010262019.png

$ imageoptim -a '**/*.png'

Expected Behaviour

Actual Behaviour

I've got an error (see below).

Output error looks like:

$ imageoptim -a EXP_IMG_893010262019.png
i Running ImageAlpha...
! Command failed with exit code 98 (Unknown system error -98): /Applications/ImageAlpha.app/Contents/MacOS/pngquant --ext=.png --force --skip-if-larger --speed=1 --quality=65-80 256 -- /var/folders/k6/78rvflqd1fd8zyttzqy7zkqm0000gn/T/imageoptim-cli/EXP_IMG_893010262019.png

! Please raise an issue at https://github.com/JamieMason/ImageOptim-CLI/issues

    Error: Command failed with exit code 98 (Unknown system error -98): /Applications/ImageAlpha.app/Contents/MacOS/pngquant --ext=.png --force --skip-if-larger --speed=1 --quality=65-80 256 -- /var/folders/k6/78rvflqd1fd8zyttzqy7zkqm0000gn/T/imageoptim-cli/EXP_IMG_893010262019.png
        at Object.exports.pngquant (/usr/local/Cellar/imageoptim-cli/3.0.0/libexec/lib/node_modules/imageoptim-cli/dist/imageoptim:475:19)
        at process._tickCallback (internal/process/next_tick.js:68:7)

Version Numbers or N/A

Help Needed

I tried to execute pngquant and it eems to work without problem:

$ /Applications/ImageAlpha.app/Contents/MacOS/pngquant --ext=.png --force --skip-if-larger --speed=1 --quality=65-80 256 -- /var/folders/k6/78rvflqd1fd8zyttzqy7zkqm0000gn/T/imageoptim-cli/EXP_IMG_893010262019.png

Other thing, it works fine without option:

$ imageoptim '**/*.png'
i Running ImageOptim...
✓ EXP_IMG_893010262019.png was: 2.99MB now: 1.18MB saving: 1.81MB (60.53%)
✓ EXP_IMG_893310262019.png was: 6.24MB now: 5.85MB saving: 390kB (6.25%)
[...]
✓ TOTAL was: 251MB now: 133MB saving: 118MB (47.05%)
✓ Finished

Thanks!

JamieMason commented 5 years ago

As far as I can tell from this search: error code 98 refers to an image which is too large for pngquant to handle, but it looks like EXP_IMG_893010262019.png was 2.99MB in size which I don't expect to be a problem.

I will be honest with you, I'm unable to reproduce this and don't have ideas for a fix at the moment.

kornelski commented 5 years ago

The code 98 is a normal behavior. It's returned when --skip-if-larger worked as advertised.

JamieMason commented 5 years ago

Thanks @kornelski. I am unblocked and can take a look at how this CLI is handling error codes.

JamieMason commented 5 years ago

Fix released in 3.0.2

rc042 commented 5 years ago

Hi, a little word to say thank you! It works fine with this version :)