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

normimg

v1.1.0

Published

Normaliza una imagen en formato cuadrado rellenado bordes con la misma imagen blurreada

Downloads

105

Readme

🤖 NormIMG 🧉

Una herramienta de línea de comandos y librería para normalizar imágenes a un formato cuadrado o rectangular, rellenando los bordes con una versión desenfocada de la misma imagen.

1. 📦 Instalación (CLI Global)

Para usar la herramienta de línea de comandos en cualquier parte de tu sistema, instálala de forma global:

npm install -g normimg

2. 🚀 Uso como Herramienta de Comandos (CLI)

Una vez instalado, puedes usar el comando normimg directamente en tu terminal (o node app.js si estás en el directorio del proyecto).

A. Procesar un Archivo Individual

normimg --input <ruta_al_archivo> [opciones]

B. Procesar un Directorio Completo

normimg --input <ruta_al_directorio> --output <directorio_de_salida> [opciones]

3. ⚙️ Opciones Disponibles

| Opción Larga | Opción Corta | Descripción | Valor por Defecto | | ----------------- | ------------ | -------------------------------------------------------------------------- | -------------------------------------------------- | | --input | -i | (Requerido) Ruta al archivo o directorio de entrada. | N/A | | --output | -o | Ruta de salida. Si es un dir, el defecto es ./output. Si es un archivo, se añade _final. | N/A | | --size | -s | El tamaño en píxeles para el lado de la imagen (formato cuadrado). Ignorado si se usan -w y -H. | 1000 | | --width | -w | El ancho final de la imagen en píxeles. | size | | --height | -H | El alto final de la imagen en píxeles. | size | | --compression | -c | La calidad de compresión JPG (0-100). | 80 | | --blur | -b | El nivel de desenfoque para el fondo (0-100). | 40 | | --help | -h | Muestra el menú de ayuda. | N/A |

4. ✨ Ejemplos (CLI)

Ejemplo 1: Imagen Individual (Cuadrada)

normimg --input ./img/img1.jpg --size 600 --compression 100 --blur 50

Ejemplo 2: De Cuadrada a Landscape (16:9)

normimg --input ./img/cuadrada.jpg --width 1920 --height 1080

Ejemplo 3: Procesar una Carpeta Completa

Este comando tomará todas las imágenes de img/, las procesará a 500px y las guardará en imagenes-procesadas/.

normimg --input ./img --output ./imagenes-procesadas --size 500

5. 📚 Uso como Librería

También puedes usar la función de normalización en tus propios proyectos de Node.js.

A. Instalación como Dependencia

npm install normimg

B. Ejemplo de Uso en tu Código

const { normalizaFoto } = require('normimg');
const path = require('path');

const imagenEntrada = path.join(__dirname, 'mi-foto.jpg');
const imagenSalida = path.join(__dirname, 'mi-foto-final.jpg');

async function procesar() {
  try {
    console.log('Normalizando imagen...');
    // Parámetros: input, output, blur, width, height, quality
    await normalizaFoto(imagenEntrada, imagenSalida, 40, 1920, 1080, 90);
    console.log(`Imagen guardada en ${imagenSalida}`);
  } catch (error) {
    console.error('Ocurrió un error:', error.message);
  }
}

procesar();