question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

squoosh-cli resize error on windows

See original GitHub issue
C:\WINDOWS\system32>npx @squoosh/cli --resize '{"enabled":true,"width":2048,"height":1365,"method":"lanczos3","fitMethod":"stretch","premultiply":true,"linearRGB":true}' --mozjpeg '{"quality":75,"baseline":false,"arithmetic":false,"progressive":true,"optimize_coding":true,"smoothing":0,"color_space":3,"quant_table":3,"trellis_multipass":false,"trellis_opt_zero":false,"trellis_opt_table":false,"trellis_loops":1,"auto_subsample":true,"chroma_subsample":2,"separate_chroma_quality":false,"chroma_quality":75}' -d d:\1 "D:\2022\FC2022SS00001.jpg"

With the resize option as up there, error occurred :

1/1 \ ▐▨▨▨▨▨╌╌╌╌╌▌ Decoding...
 D:\2022\FC2022SS00001.jpg: 5.12MBError: Need to specify at least width or height when resizing
    at resizeWithAspect (C:\Users\lx105\AppData\Roaming\npm\node_modules\@squoosh\cli\build\index.js:7:376302)
    at C:\Users\lx105\AppData\Roaming\npm\node_modules\@squoosh\cli\build\index.js:7:376891
    at preprocessImage (C:\Users\lx105\AppData\Roaming\npm\node_modules\@squoosh\cli\build\index.js:7:520890)
    at async MessagePort.<anonymous> (C:\Users\lx105\AppData\Roaming\npm\node_modules\@squoosh\cli\build\index.js:7:492960)
Worker error:  Error [RuntimeError]: abort(Error: Need to specify at least width or height when resizing). Build with -s ASSERTIONS=1 for more info.
    at process.w (C:\Users\lx105\AppData\Roaming\npm\node_modules\@squoosh\cli\build\index.js:7:360765)
    at process.emit (events.js:315:20)
    at processPromiseRejections (internal/process/promises.js:209:33)
1/1 | ▐▨▨▨▨▨╌╌╌╌╌▌ Decoding...

When I remove the resize option, the program run successfully.

C:\WINDOWS\system32>npx @squoosh/cli --mozjpeg '{"quality":75,"baseline":false,"arithmetic":false,"progressive":true,"optimize_coding":true,"smoothing":0,"color_space":3,"quant_table":3,"trellis_multipass":false,"trellis_opt_zero":false,"trellis_opt_table":false,"trellis_loops":1,"auto_subsample":true,"chroma_subsample":2,"separate_chroma_quality":false,"chroma_quality":75}' -d d:\1 "D:\2022\FC2022SS00001.jpg"
1/1 √ Squoosh results:
 D:\2022\FC2022SS00001.jpg: 5.12MB
  └ .jpg  → 480.70KB (9.17%)

But when I run cli on mac os, I have not meet the problem!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7

github_iconTop GitHub Comments

1reaction
Frank12-12commented, Apr 15, 2021

Same issue here. Removing all single Quotes before the options and then replacing all double quotes by single quotes worked for me.

0reactions
kirilloidcommented, Feb 12, 2022

I still have the same bug, worked with --resize {'enabled':true,'width':360,... as @Frank12-12 suggested BTW @surma maybe, just create another button in UI: copy options for CLI on windows? I can do the PR, but would like to know if this idea is accepted in general.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resize fit method - contain doesn't work in cli. #921 - GitHub
When I do that in CLI: npx @squoosh/cli --resize '{"enabled":true,"width":300,"height":300,"method":"lanczos3","fitMethod":"contain" ...
Read more >
How to perform SEO image optimization in a batch [squoosh-cli]
First of all, you need to prepare to use "squoosh-cli". Unix command execution environment check; Homebrew installation; Install coreulits ...
Read more >
Save hours on your image optimization process with Squoosh ...
But those times are over now, thanks to Squoosh CLI ! ... 03:55 - Usage of Squoosh CLI 06:50 - A few warnings...
Read more >
Squoosh cli - Waylon Walker
I opened my images repo and converted all pngs to webp using the command above. I got 94% compression on my existing pngs...
Read more >
Speed Up WordPress Sites with WebP and EWWW Image ...
In this article, we'll look at a few different ways to convert existing images to WebP, including Google's cwebp utility, the Squoosh app, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found