DUDE STICKER - WhatsApp Sticker Generator Library


A lightweight, high-performance JavaScript library for creating WhatsApp stickers with rich metadata support. Convert images, GIFs, and videos to WhatsApp-compatible WebP stickers with ease.
Key Features โจ
- ๐ Pure JavaScript implementation (No TypeScript build required)
- ๐ฅ Supports all WhatsApp sticker metadata (pack, author, categories)
- ๐ Multiple input formats: Buffer, URL, SVG, file path
- ๐จ Advanced styling options (crop, full, circle, rounded, star)
- ๐ Custom background colors (hex or RGBA)
- โก Optimized performance for server environments
- ๐ GIF/Video to animated WebP conversion
- ๐ฆ Built-in methods for Baileys-MD compatibility
Installation ๐ป
npm install dude-wa-sticker
yarn add dude-wa-sticker
Quick Start ๐
Basic Usage
import { Sticker, StickerTypes } from 'dude-wa-sticker';
const sticker = new Sticker('https://example.com/image.jpg', {
pack: 'Awesome Pack',
author: 'Sticker Creator',
type: StickerTypes.FULL,
categories: ['๐', 'โค๏ธ'],
quality: 90,
background: '#ffffff'
});
await sticker.toFile('sticker.webp');
const buffer = await sticker.toBuffer();
conn.sendMessage(jid, await sticker.toMessage());
Advanced Usage
const sticker = await new Sticker('local/image.png')
.setPack('Travel Pack')
.setAuthor('Wanderlust')
.setCategories(['โ๏ธ', '๐'])
.setBackground('#00a8ff')
.setQuality(80)
.toBuffer();
const svgSticker = new Sticker(`
<svg width="512" height="512" viewBox="0 0 512 512">
<circle cx="256" cy="256" r="200" fill="#ff5722"/>
</svg>
`, {
author: 'SVG Artist'
});
API Reference ๐
Sticker Class
Constructor
new Sticker(source: Buffer | string, options?: StickerOptions)
Methods
.toBuffer() | Converts sticker to Buffer | Promise<Buffer> |
.toFile(path: string) | Saves sticker to file | Promise<void> |
.toMessage() | Formats for Baileys-MD | Promise<Message> |
.setPack(pack: string) | Sets sticker pack name | this |
.setAuthor(author: string) | Sets author name | this |
.setType(type: StickerTypes) | Sets sticker type | this |
.setCategories(categories: string[]) | Sets sticker categories (emojis) | this |
.setQuality(quality: number) | Sets output quality (0-100) | this |
.setBackground(background: Color) | Sets background color | this |
StickerOptions
pack | string | undefined | Sticker pack name |
author | string | undefined | Author name |
type | StickerTypes | DEFAULT | Sticker style type |
categories | string[] | [] | Sticker categories (emojis) |
quality | number | 100 | Output quality (0-100) |
background | Color | transparent | Background color |
StickerTypes Enum
enum StickerTypes {
DEFAULT = 'default',
CROPPED = 'crop',
FULL = 'full',
CIRCLE = 'circle',
ROUNDED = 'rounded',
STAR = 'star'
}
Examples ๐จ
Creating Different Sticker Types
const cropped = new Sticker(image, {
type: StickerTypes.CROPPED
});
const circle = new Sticker(image, {
type: StickerTypes.CIRCLE,
background: '#ffffff'
});
const animated = new Sticker('animation.gif', {
pack: 'Animations',
quality: 80
});
import { extractMetadata } from 'dude-wa-sticker';
const metadata = await extractMetadata(stickerBuffer);
Best Practices โ
Contributing ๐ค
We welcome contributions! Please read our Contribution Guidelines before submitting pull requests.
License ๐
This project is licensed under the GPL-3.0.
Made with โค๏ธ by [HELVIO & REYHAN] | GitHub | npm