Skip to content

Instantly share code, notes, and snippets.

@wpyoga
Last active May 25, 2021 07:01
Show Gist options
  • Save wpyoga/a35e9e0416da7ebcffd3dfd509eb2e24 to your computer and use it in GitHub Desktop.
Save wpyoga/a35e9e0416da7ebcffd3dfd509eb2e24 to your computer and use it in GitHub Desktop.
Convert PNG to WebP (Lossless)
# -lossless
# create a lossless image
# you can use '-z 9' to really make a small image,
# but my tests show that it only produces around 1% better compression rate,
# with much longer compression times
#
# -resize 1080 1920
# (optional) resize the image
cwebp -lossless -resize 1080 1920 image.png -o image.webp
# -define webp:lossless=true
# create a lossless image
#
# -resize 1080x1920
# resize the image to 1080x1920
convert image.png -define webp:lossless=true -resize 1080x1920 image.webp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment