Invoke-Expression ".\bin\optipng.exe `" $imageFullName `" -nc -nb -o1 -strip all -quiet" Write-Progress -Activity "Optimizing $imageName" -PercentComplete $percent -Status "optipng" Invoke-Expression ".\bin\jpegoptim.exe -s `" $imageFullName `" " Write-Progress -Activity "Optimizing $imageName" -PercentComplete $percent -Status "jpegoptim" $percent = ( $imagesDone / $imagesTotal ) * 100 $imagesTotal = ($pngs.Length * 3) $jpgs.Length $jpgs = Get-ChildItem -Path $inputFolder -Include "*.jpg" -Recurse $pngs = Get-ChildItem -Path $inputFolder -Include "*.png" -Recurse # Source: # Binaries for jpegoptim # Binaries for OptiPNG # Binaries for Google's WebP # Binaryies for AVIF # Configuration I have it named web-image-optimizer.ps1, but the name doesn’t matter.
0 Comments
Leave a Reply. |