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

favicon-generator-cli

v1.2.3

Published

A Node.js CLI tool that generates a full set of favicons from PNG and SVG source images. Outputs optimized icons in multiple sizes and formats (ICO, Apple Touch Icon, Android Chrome, etc.) ready for cross-browser use.

Downloads

498

Readme

Favicon Generator CLI

A Node.js CLI tool that generates a full set of favicons from PNG and SVG source images. Outputs optimized icons in multiple sizes and formats (ICO, Apple Touch Icon, Android Chrome, etc.) ready for cross-browser use.

License

npm version Docker

Table of Contents

Features

  • Generated files:
    • favicon.ico (multi-size: 16px, 32px, 48px, 256px from PNG)
    • favicon.svg (optimized from source SVG)
    • favicon-16x16.png
    • favicon-32x32.png
    • favicon-48x48.png
    • apple-touch-icon.png (180×180px)
    • icon-192.png and icon-512.png (for Android/PWA manifest)
  • PNG and SVG input: Accepts both formats as source material. Defaults to ./favicon_src.png and ./favicon_src.svg.
  • Image optimization: Uses sharp for PNG resizing, imagemin + imagemin-pngquant for PNG compression, svgo for SVG optimization, and png2icons for ICO generation.
  • Custom output directory: Specify an output path with --dist, or let the tool create a favicons_xxxx directory in the current working directory.
  • CLI arguments: Simple command-line interface with --help for usage details.
  • Error handling: Reports missing source files and image processing failures.

Note: This tool does not generate a 512×512 maskable icon for PWA safe-zone compliance. This must be created separately using a tool like maskable.app. Make sure your PWA manifest references the maskable icon alongside other icons.

Dependencies

  • Node.js v24 LTS (tested and recommended version, specified in .nvmrc)
  • Docker (if you choose to run the tool via container)
  • npm packages (installed automatically with the tool):
    • imagemin
    • imagemin-pngquant
    • sharp
    • svgo
    • png2icons

Installation

From npm

sudo npm install -g favicon-generator-cli

From GitHub

sudo npm install -g git+https://github.com/andmitr/favicon-generator-cli.git

From Docker Registry (GitHub Container Registry)

docker pull ghcr.io/andmitr/favicon-generator-cli:latest

To use a shorter image name locally, create a tag:

docker tag ghcr.io/andmitr/favicon-generator-cli:latest favgen

Uninstall

sudo npm uninstall -g favicon-generator-cli

Troubleshooting: libvips conflict

If you have libvips installed system-wide, sharp installation may fail. Use SHARP_IGNORE_GLOBAL_LIBVIPS=1 to bypass it:

# From npm
sudo SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install -g favicon-generator-cli

# From GitHub
sudo SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install -g git+https://github.com/andmitr/favicon-generator-cli.git

# Run without installation
SHARP_IGNORE_GLOBAL_LIBVIPS=1 npx --package=favicon-generator-cli favgen

Usage

favgen [--png <path>] [--svg <path>] [--dist <output-dir>]

Docker

docker run --rm -v "$PWD:/app" ghcr.io/andmitr/favicon-generator-cli:latest [--png <path>] [--svg <path>] [--dist <output-dir>]

If you created the local favgen image tag:

docker run --rm -v "$PWD:/app" favgen [--png <path>] [--svg <path>] [--dist <output-dir>]

Shortcuts (Alias)

To avoid typing the long Docker command every time, add this alias to your ~/.bashrc or ~/.zshrc:

alias favgend='docker run --rm -v "$PWD:/app" ghcr.io/andmitr/favicon-generator-cli:latest'

Then you can use it just like the native command:

favgend --help
favgend --dist favicons

Run without installation

npx --package=favicon-generator-cli favgen [--png <path>] [--svg <path>] [--dist <output-dir>]

Arguments

| Argument | Alias | Default | Description | |----------|-------|-------------------|--------------------------------------| | --png | -p | ./favicon_src.png | Path to the source PNG image | | --svg | -s | ./favicon_src.svg | Path to the source SVG image | | --dist | -d | ./favicons_xxxx | Output directory for generated files | | --help | -h | — | Show help message and exit |

Examples

# Custom source files and output directory
favgen --png ./myicon.png --svg ./myicon.svg --dist ./favs

# Default source files, custom output directory
favgen --dist icons

HTML Usage

Add the generated favicons to the <head> of your HTML:

<link rel="icon" href="/favicon.ico" type="image/x-icon">
<link rel="icon" href="/favicon.svg" sizes="any" type="image/svg+xml">
<link rel="icon" href="/favicon-16x16.png" sizes="16x16" type="image/png">
<link rel="icon" href="/favicon-32x32.png" sizes="32x32" type="image/png">
<link rel="icon" href="/favicon-48x48.png" sizes="48x48" type="image/png">
<link rel="apple-touch-icon" href="/apple-touch-icon.png" type="image/png">
<link rel="manifest" href="/manifest.webmanifest">

Reference icon-192.png and icon-512.png in your manifest.webmanifest.

Sponsorship

BoostySupport

Bitcoin

1CCnwAvJYEoDVGM7vsBg2Q99cF9EHtBVaY

Tether

0x54f0ccc6b2987de454f69f2814fc9202bcfb74fe

License

MIT Licensed. See LICENSE for details.