npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@soblend/termux-sticker-js

v1.0.0

Published

Create WhatsApp stickers from images. Termux compatible.

Readme

@soblend/termux-sticker-js

npm version downloads license

Crea stickers de WhatsApp desde Node.js y Termux

InstalaciónUsoEjemplosAPI


¿Qué es esto?

Una librería simple para convertir imágenes (PNG, JPG, GIF, WEBP) en stickers de WhatsApp. Funciona en Node.js normal y en Termux (Android).

Características:

  • ✅ Compatible con Termux
  • ✅ Convierte cualquier imagen a sticker
  • ✅ Ajusta automáticamente a 512x512px
  • ✅ Soporta metadata (autor, pack)
  • ✅ Procesa múltiples imágenes
  • ✅ Sin dependencias pesadas

Instalación

En Termux (Android)

# Instalar dependencias del sistema
pkg update && pkg upgrade
pkg install nodejs libvips

# Instalar la librería
npm install @soblend/termux-sticker-js

En Node.js normal

npm install @soblend/termux-sticker-js

Uso Básico

Ejemplo más simple

const { createSticker } = require('@soblend/termux-sticker-js')

createSticker('imagen.jpg')
  .then(buffer => {
    require('fs').writeFileSync('sticker.webp', buffer)
    console.log('Listo!')
  })

Con opciones

const { createSticker } = require('@soblend/termux-sticker-js')

createSticker('foto.png', {
  author: 'SoBlend',
  pack: 'Mis Stickers',
  quality: 95,
  type: 'full',
  output: './stickers/mi-sticker.webp'
})
  .then(() => console.log('Sticker creado!'))
  .catch(err => console.error('Error:', err))

Ejemplos

1. Convertir una imagen simple

const { createSticker } = require('@soblend/termux-sticker-js')
const fs = require('fs')

async function ejemplo1() {
  const buffer = await createSticker('./mi-imagen.jpg')
  fs.writeFileSync('./mi-sticker.webp', buffer)
}

ejemplo1()

2. Guardar automáticamente

const { createSticker } = require('@soblend/termux-sticker-js')

createSticker('./imagen.png', {
  output: './stickers/nuevo-sticker.webp'
})

3. Agregar autor y pack

const { createSticker } = require('@soblend/termux-sticker-js')

createSticker('./foto.jpg', {
  author: 'Tu Nombre',
  pack: 'Pack de Memes 2024',
  output: './meme-sticker.webp'
})

4. Modo crop (recortar)

const { createSticker } = require('@soblend/termux-sticker-js')

// Modo 'full': ajusta la imagen completa (default)
createSticker('./imagen.jpg', { type: 'full' })

// Modo 'crop': recorta al centro
createSticker('./imagen.jpg', { type: 'crop' })

5. Ajustar calidad

const { createSticker } = require('@soblend/termux-sticker-js')

// Máxima calidad (más pesado)
createSticker('./imagen.jpg', { quality: 100 })

// Calidad media (más liviano)
createSticker('./imagen.jpg', { quality: 50 })

6. Desde un Buffer

const { createSticker } = require('@soblend/termux-sticker-js')
const fs = require('fs')

const imageBuffer = fs.readFileSync('./imagen.png')

createSticker(imageBuffer, {
  output: './sticker-desde-buffer.webp'
})

7. Procesar múltiples imágenes

const { createBatch } = require('@soblend/termux-sticker-js')

const imagenes = [
  './foto1.jpg',
  './foto2.png',
  './foto3.jpg'
]

createBatch(imagenes, {
  author: 'SoBlend',
  pack: 'Pack de Fotos',
  output: './stickers/sticker'
})
  .then(stickers => {
    console.log(`${stickers.length} stickers creados!`)
  })

8. Con async/await

const { createSticker } = require('@soblend/termux-sticker-js')
const fs = require('fs').promises

async function crearMuchos() {
  const imagenes = ['img1.jpg', 'img2.png', 'img3.jpg']
  
  for (let i = 0; i < imagenes.length; i++) {
    const buffer = await createSticker(imagenes[i], {
      author: 'Yo',
      pack: 'Mi Pack'
    })
    await fs.writeFile(`./sticker-${i}.webp`, buffer)
  }
  
  console.log('Todos listos!')
}

crearMuchos()

9. Manejo de errores

const { createSticker } = require('@soblend/termux-sticker-js')

async function seguro() {
  try {
    await createSticker('./imagen-que-no-existe.jpg', {
      output: './sticker.webp'
    })
  } catch (error) {
    if (error.message.includes('not found')) {
      console.log('La imagen no existe')
    } else if (error.message.includes('unsupported')) {
      console.log('Formato de imagen no soportado')
    } else {
      console.log('Otro error:', error.message)
    }
  }
}

seguro()

10. Script completo en Termux

#!/usr/bin/env node
const { createSticker } = require('@soblend/termux-sticker-js')
const path = require('path')

// Obtener argumentos
const args = process.argv.slice(2)
const inputFile = args[0]

if (!inputFile) {
  console.log('Uso: node script.js <imagen>')
  process.exit(1)
}

const outputFile = path.join(
  path.dirname(inputFile),
  'sticker-' + path.basename(inputFile, path.extname(inputFile)) + '.webp'
)

createSticker(inputFile, {
  author: 'Mi Termux',
  pack: 'Stickers Termux',
  quality: 95,
  output: outputFile
})
  .then(() => {
    console.log('Sticker guardado:', outputFile)
  })
  .catch(err => {
    console.error('Error:', err.message)
    process.exit(1)
  })

Guarda esto como sticker.js y úsalo:

node sticker.js mi-imagen.jpg

API Completa

createSticker(input, options)

Crea un sticker de WhatsApp.

Parámetros:

| Parámetro | Tipo | Descripción | |-----------|------|-------------| | input | string | Buffer | Ruta de la imagen o buffer | | options | Object | Configuración (opcional) |

Opciones:

| Opción | Tipo | Default | Descripción | |--------|------|---------|-------------| | author | string | '' | Nombre del autor del sticker | | pack | string | '' | Nombre del pack de stickers | | quality | number | 100 | Calidad del WebP (1-100) | | type | string | 'full' | Tipo de ajuste: 'full' o 'crop' | | output | string | null | Ruta donde guardar (opcional) |

Retorna: Promise<Buffer> - Buffer del sticker en formato WebP

Ejemplo:

const buffer = await createSticker('./foto.jpg', {
  author: 'Yo',
  pack: 'Mi Pack',
  quality: 90,
  type: 'crop',
  output: './sticker.webp'
})

createBatch(inputs, options)

Crea múltiples stickers a la vez.

Parámetros:

| Parámetro | Tipo | Descripción | |-----------|------|-------------| | inputs | Array<string\|Buffer> | Array de rutas o buffers | | options | Object | Mismas opciones que createSticker |

Retorna: Promise<Array<Buffer>> - Array de buffers (null si hubo error)

Ejemplo:

const stickers = await createBatch(
  ['img1.jpg', 'img2.png', 'img3.jpg'],
  {
    author: 'Yo',
    pack: 'Mis Fotos',
    output: './stickers/sticker'
  }
)

Tipos de Ajuste

type: 'full' (default)

Ajusta la imagen completa dentro de 512x512px sin recortar. Agrega transparencia si es necesario.

Mejor para: Logos, ilustraciones, imágenes con transparencia

createSticker('logo.png', { type: 'full' })

type: 'crop'

Recorta la imagen desde el centro para llenar 512x512px completamente.

Mejor para: Fotos, retratos, memes

createSticker('foto.jpg', { type: 'crop' })

Formatos Soportados

  • JPEG (.jpg, .jpeg)
  • PNG (.png)
  • WebP (.webp)
  • GIF (.gif)

Requisitos

  • Node.js >= 14.0.0
  • En Termux: pkg install libvips

Solución de Problemas

Error: "Cannot find module 'sharp'"

npm install sharp

En Termux:

pkg install libvips
npm install sharp

Error: "unsupported type"

Solo se permiten imágenes JPG, PNG, WebP y GIF. Verifica el formato de tu imagen.

Error: "file not found"

La ruta de la imagen no existe. Verifica que la ruta sea correcta.

Los stickers no se ven en WhatsApp

Asegúrate de que:

  1. El archivo sea .webp
  2. El tamaño sea 512x512px (esto lo hace la librería automáticamente)
  3. Envía el archivo como sticker, no como imagen

Comparación con otras librerías

| Característica | termux-sticker-js | wa-sticker-format | otros | |----------------|-------------------|-------------------|-------| | Compatible Termux | ✅ | ❌ | ❌ | | Sin dependencias pesadas | ✅ | ❌ | ❌ | | Fácil de usar | ✅ | ❌ | ⚠️ | | Metadata | ✅ | ✅ | ⚠️ | | Batch processing | ✅ | ❌ | ❌ |


Roadmap

  • [ ] Soporte para videos/GIFs animados
  • [ ] Crop inteligente con detección de rostros
  • [ ] CLI tool integrado
  • [ ] Compresión automática
  • [ ] Soporte para animated stickers

Licencia

MIT © SoBlend

By Soblend | Development Studio