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

imglite

v1.0.0

Published

CLI tool to convert PNG and JPEG images to WebP and other modern formats

Readme

imglite

A powerful command-line tool for efficiently converting images to WebP and other modern formats.

Features

  • Image Format Conversion

    • Convert PNG, JPEG, and JPG images to WebP (default), AVIF, JPEG, or PNG
    • Maintain image quality with configurable settings
    • Smart adaptive quality based on image content
  • Processing Options

    • Batch processing with customizable concurrency
    • Process individual files or entire directories
    • Recursive directory scanning
    • Replace original files or keep both versions
    • Exclude specific directories or patterns
    • Configurable output directory
  • Image Optimization

    • Resize images (fixed dimensions or percentage)
    • Set maximum width/height constraints
    • Space savings reporting
  • Developer Experience

    • Git integration with staged files mode
    • Automatic pre-commit hook setup
    • Dry run mode to preview what would be processed
    • Configuration file support
    • Intelligent caching to avoid reprocessing
    • Progress visualization
    • Detailed reporting with file size savings

Installation

Global Installation

npm install -g imglite

Local Installation

npm install imglite

Usage

Basic Usage

Convert all images in the current directory to WebP:

imglite

Convert specific images:

imglite -i ./images/logo.png

Convert images in a specific directory:

imglite -i ./images

Advanced Usage

Process images with adaptive quality:

imglite -i ./images --adaptive-quality

Convert to AVIF format:

imglite -i ./images --format avif

Resize images to 50% of original size:

imglite -i ./images --resize 50%

Set maximum dimensions (preserving aspect ratio):

imglite -i ./images --max-width 1200 --max-height 800

Process 8 images concurrently:

imglite -i ./images -R --concurrency 8

Only process Git staged images:

imglite --staged

Preview what would be processed without making changes:

imglite -i ./images --dry-run

Options

Options:
  --input, -i           Directory or specific files to process    [string] [default: "."]
  --output, -o          Output directory (if not specified, files are placed alongside originals)
  --quality, -q         WebP quality (0-100)                      [number] [default: 80]
  --min-quality         Minimum quality for adaptive mode         [number] [default: 50]
  --max-quality         Maximum quality for adaptive mode         [number] [default: 90]
  --adaptive-quality    Automatically adjust quality based on image content
                                                                 [boolean] [default: false]
  --replace, -r         Replace original files instead of keeping both
                                                                 [boolean] [default: false]
  --recursive, -R       Recursively scan directories             [boolean] [default: false]
  --ext, -e             File extensions to process (comma-separated)
                                                 [string] [default: "png,jpg,jpeg"]
  --exclude, -x         Directories or patterns to exclude (comma-separated)
                                       [string] [default: "node_modules,dist,build,.git"]
  --format, -f          Output format (webp, avif, jpeg, png)
                                          [string] [choices: "webp", "avif", "jpeg", "png"]
                                                                   [default: "webp"]
  --concurrency, -c     Number of images to process concurrently  [number] [default: based on CPU cores]
  --resize              Resize images (format: WIDTHxHEIGHT, e.g. 800x600, or 50%)
  --max-width           Maximum width of output images            [number]
  --max-height          Maximum height of output images           [number]
  --staged              Only process Git staged image files       [boolean] [default: false]
  --dry-run             Show what would be processed without making changes
                                                                 [boolean] [default: false]
  --no-cache            Disable caching (always reprocess images) [boolean] [default: false]
  --cache-dir           Directory to store cache files            [string]
  --silent              Suppress all output except errors         [boolean] [default: false]
  --verbose             Show detailed processing information      [boolean] [default: false]
  --init                Initialize imglite with a git pre-commit hook
                                                                 [boolean] [default: false]
  --help                Show help                                 [boolean]

Git Integration

To set up imglite as a Git pre-commit hook:

imglite --init

This will automatically create a pre-commit hook that processes any staged image files before each commit.

Configuration File

You can create a configuration file to avoid typing the same options repeatedly. imglite will look for configuration in these locations:

  • .imgliterc
  • .imgliterc.json
  • .imgliterc.js
  • imglite.config.js
  • ~/.imgliterc

Example configuration file (.imgliterc.json):

{
  "quality": 85,
  "recursive": true,
  "adaptiveQuality": true,
  "format": "webp",
  "exclude": ["node_modules", "dist", "build", ".git", "temp"]
}

Examples

Simple Conversion Workflow

# Convert all images in src/assets recursively
imglite -i src/assets -R

# Check the results
ls -la src/assets

Build Process Integration

Add to your package.json:

"scripts": {
  "optimize-images": "imglite -i src/assets -o dist/assets -R -q 85"
}

Then run:

npm run optimize-images

Adaptive Quality with Size Reporting

imglite -i ./photos --adaptive-quality --verbose

License

MIT