Skip to content

Instantly share code, notes, and snippets.

@Nooshu
Last active November 10, 2020 22:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nooshu/fd6c0f1f1a80bd50c47d4c755e8b46a6 to your computer and use it in GitHub Desktop.
Save Nooshu/fd6c0f1f1a80bd50c47d4c755e8b46a6 to your computer and use it in GitHub Desktop.
Find all PNG's in a directory, convert to WebP / AVIF. Output using the same filename.
## WebP
find ./ -type f -name '*.png' -exec sh -c 'cwebp -lossless $1 -o "${1%.png}.webp"' _ {} \;\n
## AVIF (s=speed / 0-10 / slowest-fastest)
find ./ -type f -name '*.png' -exec sh -c 'avifenc -s 6 $1 -o "${1%.png}.avif"' _ {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment