Registry / messaging / stickers-formatter

stickers-formatter

JSON →
library0.0.2jsnpmunverified

A feature-rich fork of wa-sticker-formatter for creating and formatting WhatsApp stickers. Supports static images, GIFs, videos (animated WebP), and SVG input. Provides a fluent class-based API (Sticker) and a functional createSticker() function. Includes metadata extraction, custom backgrounds, sticker types (Default, Crop, Full, Circle, Rounded), and Baileys-MD compatibility. Version 0.0.2, actively maintained with TypeScript types included.

npm install stickers-formatter
INSTALL
IMPORT
SIG · STICKERS-FORMATTER
S
stickers-formatter
messagingjavascriptv0.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Sticker
import { Sticker } from 'stickers-formatter'
const Sticker = require('stickers-formatter').Sticker
ESM import is recommended. CommonJS require works but breaks tree-shaking.
createSticker
import { createSticker } from 'stickers-formatter'
import createSticker from 'stickers-formatter'
Must be a named import, not default.
StickerTypes
import { StickerTypes } from 'stickers-formatter'
Enum-like object with values: DEFAULT, CROP, FULL, CIRCLE, ROUNDED.
IStickerOptions
import type { IStickerOptions } from 'stickers-formatter'
import { IStickerOptions } from 'stickers-formatter'
TypeScript only; use type import for runtime efficiency.

Creates a WhatsApp sticker from a local image, applies full type, white background, and emoji categories, then saves as WebP.

import { Sticker, StickerTypes } from 'stickers-formatter'; import { writeFile } from 'fs/promises'; async function createSticker() { const sticker = new Sticker('./image.png', { pack: 'My Sticker Pack', author: 'Me', type: StickerTypes.FULL, quality: 80, background: '#ffffff', categories: ['😀', '🎉'] }); const buffer = await sticker.toBuffer(); await writeFile('sticker.webp', buffer); console.log('Sticker created!'); } createSticker().catch(console.error);
Debug
Known issues
breakingVersion 0.0.2 removed support for Node < 14
fix
Upgrade to Node 14+ or use wa-sticker-formatter (v1.x) for older Node versions.
affects: >=0.0.2
deprecatedThe `StickerTypes` string literals are deprecated; use enum-like values instead
fix
Replace 'default' with StickerTypes.DEFAULT, 'crop' with StickerTypes.CROP, etc.
affects: >=0.0.2
gotchaSharp must be installed separately for image processing; not a direct dependency
fix
Run `npm install sharp` in addition to stickers-formatter.
affects: >=0.0.2
gotchaAnimated WebP output requires the `libwebp` binary installed on system PATH
fix
Install libwebp (e.g., `apt install libwebp` on Debian; `brew install webp` on macOS).
affects: >=0.0.2
gotcha`Sticker.toMessage()` returns a baileys-compatible object but does NOT send the message; only formats it
fix
Use `sock.sendMessage(jid, await sticker.toMessage())` to actually send via Baileys.
affects: >=0.0.2
breakingThe constructor now throws if `image` argument is not a valid Buffer, string, or URL
fix
Ensure input is a Buffer, file path, or URL string. Check for undefined/null before constructing.
affects: >=0.0.2
Errors
Common errors & fixes
Error: Cannot find module 'sharp'
Sharp is a peer dependency and must be installed separately.
fix
npm install sharp
TypeError: sticker.toBuffer is not a function
Using CommonJS require on ESM-only version or wrong import.
fix
Use `import { Sticker } from 'stickers-formatter'` or upgrade to CJS-compatible version.
UnhandledPromiseRejection: Error: spawn libwebp_mux ENOENT
libwebp binaries not installed on system.
fix
Install libwebp package (see README for OS-specific commands).
TypeError: Invalid or unsupported sticker type: XYZ
Passing a string that is not one of the allowed StickerTypes values.
fix
Use enum-like StickerTypes.DEFAULT, StickerTypes.CROP, etc., or lowercase string 'default', 'crop', 'full', 'circle', 'rounded'.
Error: Input image is empty or invalid
Buffer is empty or file path does not exist / is not an image.
fix
Check that the image source exists and is a valid image format (PNG, JPEG, GIF, WebP, SVG).
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies
sharprequiredImage processing (resize, crop, format conversion)
libwebpoptionalWebP encoding for sticker output
axiosoptionalHTTP requests for fetching remote images
Agent activity
21 hits · last 30 days
node
18
OpenAI (training)
1
Resources
stickers-formatter — npm install stickers-formatter · libregistry