Every chat app has its own sticker rules, and they don't agree. WhatsApp wants exactly 512 x 512 px, WebP, 100 KB or less. Discord wants a 320 x 320 PNG. Telegram wants one side at exactly 512 px and doesn't care about the other. Slack has no stickers at all, only emoji under 128 KB.

I make a sticker app, and "why won't WhatsApp take my sticker?" is a question I keep running into. Instead of explaining pixel and size rules every time, I built a small free checker and fixer that runs in the browser: getpaplo.com/sticker-checker.

The one hard rule I set: the images never leave the browser. No upload, no server, no account. Here is how the browser pipeline works, and the platform quirks that shaped it.

Reading a file without trusting it

The checker looks at four things per file: pixel size, format, transparency and file size.

Pixel size comes from createImageBitmap, with one detail that matters for phone photos:

const bitmap = await createImageBitmap(file, { imageOrientation: 'from-image' }); 

from-image applies the EXIF rotation, so the width and height are the ones people actually see, not the sensor's.

Transparency is a pixel scan: draw the bitmap to a canvas, read the alpha channel, stop at the first pixel below 255. JPGs skip the scan because they have no alpha channel. A file with no transparent pixel is a photo with a background, not a sticker, so the tool refuses to turn it into a white square and says it needs background removal first.

Format comes from the MIME type, but animation does not show up there. So the tool reads a few bytes:

  • Animated WebP: RIFF....WEBPVP8X, then bit 0x02 of the flags byte.
  • APNG: an acTL chunk before the first IDAT.
  • GIF: count image descriptors (0x2C) while skipping extension blocks; more than one means animated.

Animated files are checked but not fixed. Re-encoding animation in the browser is a different project.

Fixing: fit, convert, then shrink

Fitting is "contain, never crop". For exact-size targets the image is centred on a transparent canvas. Telegram is the odd one out: the longest side becomes 512 px and the other keeps its proportion, with no padding.

Then the file has to get under the size limit. The browser's encoder takes a quality from 0 to 1, so the tool steps down until the result fits:

const QUALITY_STEPS = [0.92, 0.85, 0.78, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2]; async function stepQuality(encode, limit) { let last; for (const quality of QUALITY_STEPS) { last = { quality, bytes: await encode(quality) }; if (last.bytes <= limit) return { ...last, fits: true }; } return { ...last, fits: false }; } 

Best quality first, so a sticker only loses as much as it has to. PNG has no quality knob, so when a PNG is too big and the app also accepts WebP (Telegram, Signal), it switches to WebP. When the app only takes PNG (Discord, Slack), the tool says the file is too large instead of quietly wrecking it.

The Safari problem

This was the biggest surprise. WhatsApp requires WebP, and the obvious browser API is:

canvas.toBlob(resolve, 'image/webp', 0.8); 

Chrome and Firefox return a WebP. Safari returns a PNG. No error, just a different format. You can only find out by checking:

const nativeWebp = document.createElement('canvas') .toDataURL('image/webp') .startsWith('data:image/webp'); 

On iPhone that means the main use case, WhatsApp stickers, would silently produce the wrong file. The fix is libwebp compiled to WebAssembly, through jSquash. Two choices kept it light:

  1. Load it only when needed. The encoder is fetched the first time someone presses Fix on a browser without native WebP encoding. Everyone else never downloads it.
  2. Serve it from my own origin. The .js and .wasm files are copied out of node_modules at build time and cached for a week. No CDN, so the "nothing leaves your browser" promise stays simple to check.

There is a SIMD build and a plain one. A tiny WebAssembly.validate call on a SIMD opcode picks which to load.

A ZIP writer with no dependency

Fixing 30 stickers and downloading them one by one is miserable, so the tool bundles them into a ZIP. PNG and WebP files are already compressed, so deflate would gain almost nothing. A "store only" ZIP is just local headers, the raw bytes, a central directory and an end record, plus a CRC-32 per file. No dependency needed.

What I'd tell anyone building a tool like this

  • Put the limits in one data file. The same numbers feed the checker and a written guide on my site, and a test fails if they drift apart. Platforms change these limits quietly.
  • Test the format you got, not the one you asked for. Safari taught me that.
  • Say what you won't fix. "Needs a cutout" and "too large for PNG" are more useful than a broken file.

You can try the checker at getpaplo.com/sticker-checker. If a platform has changed its limits, or you have hit other strange canvas.toBlob behaviour, tell me in the comments.