kamsar / Dianoga

An automatic image optimizer for the Sitecore media library.
Other
104 stars 45 forks source link

Error resizing gif images with Webp enabled #74

Closed galiana closed 3 years ago

galiana commented 4 years ago

Version of Dianoga ### 5.0.2

Environment description ### Dev Environment (Single VM), Sitecore 8.2 Initial release

What configs you have enabled

Reproducible steps (1... 2... 3...) that cause the issue

  1. Upload a gif file

  2. Render it with the format: https://server/-/media/image.gif?mw=xx&hash=xxx

What you expected to see, versus what you actually saw

I'm expecting a resized gif file, but i get the following error: Error! Unknown option '-resize'

Some extra information

Obviously, the external tool gif2webp.exe does not support resizing images (or at least the mentioned parameter) and in the pipeline processor Dianoga/src/Dianoga/Optimizers/Pipelines/DianogaWebP/WebPOptimizer.cs we are always sending the resize parameter if requested at line 22, no matter the actual optimizer used.

Relevant logs

3536 14:54:39 ERROR Dianoga: Unable to optimize due to a processing error! It will be unchanged. Exception: System.InvalidOperationException Message: "C:\inetpub\wwwroot\xxx\Website\App_Data\Dianoga Tools\libwebp-1.1.0-windows-x64\bin\gif2webp.exe -q 80 -lossy -resize 0 0 "C:\WINDOWS\TEMP\tmp6C0B.tmp" -o "C:\WINDOWS\TEMP\tmp6C0C.tmp" " exited with unexpected exit code -1. Output: Error! Unknown option '-resize' copy from the input to the output if present -metadata ..... comma separated list of metadata to -f ............... filter strength (0=off..100) -kmax ............ max distance between key frames -kmin ............ min distance between key frames options combined with -q, -m, -lossy or -mixed lossless compression by default; can be -min_size .............. minimize output size (default:off) -m ............... compression method (0=fast, 6=slowest) -q ............. quality factor (0:small..100:big) or lossless compression heuristically -mixed ................. for each frame in the image, pick lossy -lossy ................. encode image using lossy compression -h / -help ............. this help Options: gif2webp [options] gif_file -o webp_file Usage:

-quiet ................. don't print anything -v ..................... verbose -version ............... print version number and exit

-mt .................... use multi-threading if available version prior to M62 (inclusive) -loop_compatibility .... use compatibility mode for Chrome Valid values: all, none, icc, xmp (default) Source: Dianoga at Dianoga.Optimizers.CommandLineToolOptimizer.ExecuteProcess(String arguments) at Dianoga.Optimizers.CommandLineToolOptimizer.ProcessOptimizer(OptimizerArgs args) at Dianoga.Optimizers.OptimizerProcessor.Process(OptimizerArgs args)