Skip to content

Instantly share code, notes, and snippets.

@Sevaarcen
Last active March 1, 2022 20:56
Show Gist options
  • Save Sevaarcen/739c0b3c2087ca1ef3712c3b19a8ce84 to your computer and use it in GitHub Desktop.
Save Sevaarcen/739c0b3c2087ca1ef3712c3b19a8ce84 to your computer and use it in GitHub Desktop.
Bulk Convert PNG to WEBP
# https://developers.google.com/speed/webp/download
Get-ChildItem -Path . -File -Depth 0 | ForEach-Object -Parallel { &'C:\Program Files\libwebp\bin\cwebp.exe' -q 75 "$_" -o "$([io.path]::GetFileNameWithoutExtension($_)).webp" } -ThrottleLimit 16
@bgoewert
Copy link

bgoewert commented Mar 1, 2022

Useful flags for bulk converting

-mt

  • For multi-threading, if possible.

-m 0-6

  • Specify the compression method to use. This parameter controls the trade off between encoding speed and the compressed file size and quality. Possible values range from 0 to 6. Default value is 4. When higher values are used, the encoder will spend more time inspecting additional encoding possibilities and decide on the quality gain. Lower value can result in faster processing time at the expense of larger file size and lower compression quality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment