Converting images to WebP
These recipes produce files that meet WhatsApp's sticker rules: a 512 × 512 canvas, transparency preserved, and a file size inside the budget.
Tools
| Tool | Install | Good for |
|---|---|---|
cwebp, gif2webp, img2webp, webpinfo | brew install webp · apt install webp | Static stickers, GIF conversion, inspection |
ImageMagick (magick) | brew install imagemagick · apt install imagemagick | Padding non-square images |
ffmpeg | brew install ffmpeg · apt install ffmpeg | Video and GIF → animated WebP with resizing |
Square PNG → static sticker
If your PNG is already 512 × 512 with a transparent background:
cwebp -q 80 -alpha_q 100 input.png -o sticker.webp-q controls colour quality (lower = smaller); -alpha_q 100 keeps edges clean. If the result is over 100 KB, step -q down by 10 and try again.
For flat artwork where you want pixel-exact output:
cwebp -lossless -z 9 input.png -o sticker.webpNon-square images
Fit the longest side to 512 px and pad the rest with transparency.
ImageMagick:
magick input.png -resize 512x512 -background none -gravity center -extent 512x512 \
-quality 80 sticker.webpffmpeg:
ffmpeg -i input.png \
-vf "scale=512:512:force_original_aspect_ratio=decrease,format=rgba,pad=512:512:(ow-iw)/2:(oh-ih)/2:color=black@0" \
-c:v libwebp -quality 80 sticker.webpcwebp -resize 512 512 also works, but it stretches non-square input — only use it on images that are already square.
Batch-convert a folder
mkdir -p out
for f in *.png; do
cwebp -quiet -q 80 -alpha_q 100 "$f" -o "out/${f%.png}.webp"
doneGIF to animated WebP
If the GIF is already 512 × 512:
gif2webp -lossy -q 70 -m 6 input.gif -o sticker.webp-lossy gives much smaller files than the default lossless mode; -m 6 spends more time compressing for a smaller result.
If the GIF needs resizing or padding, use ffmpeg:
ffmpeg -i input.gif -t 10 \
-vf "fps=15,scale=512:512:force_original_aspect_ratio=decrease,format=rgba,pad=512:512:(ow-iw)/2:(oh-ih)/2:color=black@0" \
-c:v libwebp -lossless 0 -quality 60 -loop 0 -an sticker.webpVideo to animated WebP
The same ffmpeg command works for MP4, MOV and WebM. Add -ss to choose the start point:
ffmpeg -ss 00:00:02 -i clip.mp4 -t 6 \
-vf "fps=15,scale=512:512:force_original_aspect_ratio=decrease,format=rgba,pad=512:512:(ow-iw)/2:(oh-ih)/2:color=black@0" \
-c:v libwebp -lossless 0 -quality 55 -loop 0 -an sticker.webpVideo has no transparency, so the subject will sit on its original background unless you remove it first (for example with a background-removal tool that exports transparent frames).
Check the output
webpinfo -summary sticker.webp # canvas size, frame count, alpha
ls -l sticker.webp # file size in bytes (100 KB = 102,400 bytes)Over budget? See Getting under 100 KB and Staying under 500 KB.
Prefer not to use the command line?
Sticker-maker apps handle cropping, padding and WebP export for you. Sticko is one option for Android and iPhone.