DEV Community

Turingna Zhang
Turingna Zhang

Posted on

Make a transparent WebP that WhatsApp and Telegram will accept as a sticker

A sticker that looks fine on your desktop often fails the moment you try to add it to a chat app. WhatsApp wants a square WebP. Telegram wants the same shape and a transparent background. Discord is happier with a smaller PNG. If you only have a JPEG with a white box around the cat, none of those apps will treat it as a sticker.

This is the file spec I use, and a short Python path to produce it. No account, no design tool.

The spec that actually gets accepted

Static stickers, not animated:

App File Size Notes
WhatsApp WebP 512×512 Static sticker pack limit is 100KB per sticker
Telegram WebP or PNG 512×512 One side must be 512px; transparent background
Discord PNG about 320×320 Emoji/sticker slot is small; a 512 file also works, but 320 is the one I export for chat

If you keep one master, keep the 512×512 transparent WebP, then export the 320 PNG from it. Do not start from a screenshot.

What breaks the upload

  • A white or colored background. The app draws a rectangle, and the sticker looks pasted on.
  • Text smaller than the face. At thumbnail size the letters disappear, and the joke goes with them.
  • A wide image squeezed into a square. Crop first, then resize.
  • A 2000px PNG renamed to .webp. The extension is not the format.

Convert one image

I use Pillow. Install it once:

pip install pillow
✨ อัปเดตล่าสุด: turingna zhang cad/make a transparent webp that whatsapp and telegram will accept as a sticker - สรุปดราม่าล่าสุด ✨ อัปเดตล่าสุด: turingna zhang cad/make a transparent webp that whatsapp and telegram will accept as a sticker - สรุปดราม่าล่าสุด
from PIL import Image

src = Image.open("cat.png").convert("RGBA")

# Crop to the non-transparent pixels so a loose canvas does not shrink the face.
bbox = src.getbbox()
if bbox:
    src = src.crop(bbox)

side = max(src.size)
canvas = Image.new("RGBA", (side, side), (0, 0, 0, 0))
canvas.paste(src, ((side - src.width) // 2, (side - src.height) // 2), src)

web = canvas.resize((512, 512), Image.Resampling.LANCZOS)
web.save("cat-512.webp", format="WEBP", quality=80, method=6)

png = canvas.resize((320, 320), Image.Resampling.LANCZOS)
png.save("cat-320.png", format="PNG", optimize=True)

print("webp bytes", len(open("cat-512.webp", "rb").read()))
✨ อัปเดตล่าสุด: turingna zhang cad/make a transparent webp that whatsapp and telegram will accept as a sticker - สรุปดราม่าล่าสุด ✨ อัปเดตล่าสุด: turingna zhang cad/make a transparent webp that whatsapp and telegram will accept as a sticker - สรุปดราม่าล่าสุด

If the printed byte count is over 100000, lower quality to 70 and run it again. WhatsApp rejects a static sticker above 100KB even when the dimensions are right.

Check the file before you send it

Open the WebP on a dark page and a photo. You should see the character, not a box. Then check the header so you know it is really WebP:

print(open("cat-512.webp", "rb").read(12))
# b'RIFF....WEBP'
✨ อัปเดตล่าสุด: turingna zhang cad/make a transparent webp that whatsapp and telegram will accept as a sticker - สรุปดราม่าล่าสุด ✨ อัปเดตล่าสุด: turingna zhang cad/make a transparent webp that whatsapp and telegram will accept as a sticker - สรุปดราม่าล่าสุด

That is the whole pipeline: crop to the visible pixels, pad to a square, resize to 512, export WebP under 100KB, and keep a 320 PNG beside it.

I publish a free set already exported this way, including cat and Christmas reactions, at FunnieStickers. The published library is 192 stickers. The cat tray is here and the Christmas tray is here. Same files: 512 WebP for WhatsApp and Telegram, 320 PNG for Discord, no sign-up.

If you only need the method, the script above is enough. If you do not want to convert anything, the library is the shortcut.

Top comments (0)