{"id":42284,"library":"wa-sticker-formatter","title":"Wa-Sticker-Formatter","description":"Wa-Sticker-Formatter v4.4.4 is a Node.js library for creating WhatsApp stickers from images, GIFs, videos, SVG strings, or buffers. It produces WebP files and integrates with Baileys via `toMessage()`. Active development, TypeScript-first with full type definitions. Supports pack/author metadata, emoji categories, background color, cropping/background-fill types, and quality control. CommonJS and ESM compatible, but ESM is recommended for modern projects.","status":"active","version":"4.4.4","language":"javascript","source_language":"en","source_url":"https://github.com/AlenVelocity/wa-sticker-formatter","tags":["javascript","whatsapp","stickers","whatsapp-stickers","webp","typescript"],"install":[{"cmd":"npm install wa-sticker-formatter","lang":"bash","label":"npm"},{"cmd":"yarn add wa-sticker-formatter","lang":"bash","label":"yarn"},{"cmd":"pnpm add wa-sticker-formatter","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Image processing library used for resizing, cropping, and converting to WebP","package":"sharp","optional":false},{"reason":"Detects input file type to handle images vs videos","package":"file-type","optional":false},{"reason":"Alternative image processing when sharp is not available","package":"@jimp/custom","optional":true}],"imports":[{"note":"Named export, not default. Use curly braces.","wrong":"import Sticker from 'wa-sticker-formatter'","symbol":"Sticker","correct":"import { Sticker } from 'wa-sticker-formatter'"},{"note":"Valid as CommonJS, but ESM is preferred. In TypeScript, destructure the enum.","wrong":"const StickerTypes = require('wa-sticker-formatter').StickerTypes","symbol":"StickerTypes","correct":"import { StickerTypes } from 'wa-sticker-formatter'"},{"note":"Renaming is fine functionally but avoid confusion. The function returns a Promise<Buffer>.","wrong":"import { createSticker as create } from 'wa-sticker-formatter'","symbol":"createSticker","correct":"import { createSticker } from 'wa-sticker-formatter'"}],"quickstart":{"code":"import { Sticker, StickerTypes } from 'wa-sticker-formatter';\nimport fs from 'fs';\n\nconst sticker = new Sticker('path/to/image.jpg', {\n  pack: 'My Pack',\n  author: 'Me',\n  type: StickerTypes.FULL,\n  categories: ['🤩', '🎉'],\n  quality: 80,\n  background: '#FF0000'\n});\n\nconst buffer = await sticker.toBuffer();\nfs.writeFileSync('sticker.webp', buffer);\n\n// Or directly as a file:\nawait sticker.toFile('sticker.webp');","lang":"typescript","description":"Creates a WhatsApp sticker from a local image file with custom pack name, author, type, categories, quality, and background color."},"warnings":[{"fix":"Ensure the input is one of: Buffer (image/gif/video), SVG string, URL, or file path to such a file.","message":"Input must be a valid image, GIF, video, or SVG string. Passing a non-image buffer or file path results in an error.","severity":"gotcha","affected_versions":">=4.0"},{"fix":"Use `new Sticker(buffer, options)` or chain `new Sticker(buffer).setPack('...')` etc.","message":"The `Sticker` class constructor with a single buffer argument (without options) is deprecated. Options should be provided as the second argument or via setters.","severity":"deprecated","affected_versions":">=4.0"},{"fix":"Use `StickerTypes.CROP` or `StickerTypes.FULL` (enum), or the exact strings 'crop' / 'full'.","message":"Sticker types `crop` or `full` are case-sensitive. Using wrong casing will fallback to default (crop).","severity":"gotcha","affected_versions":">=4.0"},{"fix":"Install sharp: `npm install sharp`","message":"Sharp is required for video-to-webp conversion. If not installed, it throws an error. Versions before 4.x allowed a fallback.","severity":"breaking","affected_versions":">=4.0"},{"fix":"Set `type: StickerTypes.FULL` if you need a background color.","message":"The `background` option only works with `type: StickerTypes.FULL`. Using it with `type: crop` or default has no effect.","severity":"gotcha","affected_versions":">=4.0"},{"fix":"Use `toBuffer()` or `toFile()` if not using Baileys.","message":"`toMessage()` returns an object for Baileys-MD, but it requires a `conn` object with a `sendMessage` method. Using without Baileys will cause errors.","severity":"gotcha","affected_versions":">=4.0"},{"fix":"Use `import { Sticker } from 'wa-sticker-formatter'` for types, or use `// @ts-ignore` for require.","message":"When using CommonJS `require`, TypeScript type definitions are not automatically imported. User must import types separately if needed.","severity":"gotcha","affected_versions":">=4.0"}],"env_vars":null,"search_vec":"'activ':36 'background':50 'bailey':33 'buffer':25 'categori':49 'color':51 'commonj':57 'compat':60 'control':56 'creat':15 'cropping/background-fill':52 'definit':44 'develop':37 'emoji':48 'esm':59,62 'file':29 'first':40 'formatt':4,8 'full':42 'gif':20 'imag':19 'integr':31 'javascript':68 'librari':13 'metadata':47 'modern':66 'node.js':12 'pack/author':46 'produc':27 'project':67 'qualiti':55 'recommend':64 'sticker':3,7,17,70,73 'string':23 'support':45 'svg':22 'tomessag':35 'type':43,53 'typescript':39,75 'typescript-first':38 'v4.4.4':9 'via':34 'video':21 'wa':2,6 'wa-sticker-formatt':1,5 'webp':28,74 'whatsapp':16,69,72 'whatsapp-stick':71","created_at":"2026-06-04T18:56:31.129009+00:00","updated_at":"2026-06-04T18:56:31.129009+00:00","problems":[{"fix":"Ensure the file exists and the path is correct. Use absolute paths or resolve relative paths with `path.resolve()`.","cause":"The file path provided does not exist or is not accessible.","error":"Error: Input file is missing"},{"fix":"Check the input format. Must be one of: jpeg, png, gif, webp, svg, mp4. For videos, ensure sharp is installed.","cause":"The input buffer or file is not a valid image/video format.","error":"TypeError: Cannot read property 'width' of undefined"},{"fix":"Run `npm install sharp` to install sharp.","cause":"Sharp dependency missing. Required for video and some image processing.","error":"Error: sharp is not installed"},{"fix":"Use `new Sticker(...)` instead of `Sticker(...)`.","cause":"Called Sticker as a function instead of with new keyword.","error":"TypeError: Class constructor Sticker cannot be invoked without 'new'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/AlenVelocity/wa-sticker-formatter#readme","github":"https://github.com/AlenVelocity/wa-sticker-formatter","docs":null,"changelog":null,"pypi":null,"npm":"wa-sticker-formatter","openapi_spec":null,"status_page":null,"smithery":null,"categories":["messaging"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}