FavIconer CLI Utility

faviconer is a command line application for creating favicon files from a single source file. Typically the source file will be a larger version, like 512x512 or 1024x1024. This utility will create PNG files in 16x16, 32x32, 48x48, 64x64 sizes, and an ico file with those sizes in it. It also creates an android chrome icon and apple touch icon.

The favicon is the icon that appears in the title bar of the browser, and is used when creating an icon in the bookmark bar.

I created this utility to streamline creating my favicons so I can do it as part of my build process.

whlogo-sizes

Usage

C:> faviconer --help
Generate favicon, app icons, and a web manifest.
Version 1.0.0+5

Usage: dart run bin/faviconer.dart --input <file> [options]

-i, --input                    Source image path (.png, .jpg, .jpeg, .webp, or .ico for --list-ico)
-o, --output-dir               Directory to write generated files into
                               (defaults to ".")
-n, --name                     Base filename for favicon outputs
                               (defaults to "favicon")
    --[no-]trim-transparent    Trim transparent edges before resizing
    --[no-]crop-square         Crop to a square instead of fitting inside a transparent square
    --background               Background color: transparent or hex like FFFFFF / FFFFFFFF
                               (defaults to "transparent")
    --[no-]manifest            Generate site.webmanifest
                               (defaults to on)
    --app-name                 Name used in site.webmanifest
                               (defaults to "App")
    --theme-color              Theme color used in site.webmanifest
                               (defaults to "#ffffff")
    --background-color         Background color used in site.webmanifest
                               (defaults to "#ffffff")
    --[no-]list-ico            List the images stored inside an existing .ico file
-h, --help                     Show usage

Examples:
  dart run bin/faviconer.dart --input logo.webp --output-dir build/icons --app-name "Bookmark Squirrel"
  dart run bin/faviconer.dart --input logo.png --crop-square --background FFFFFF

Suggested favicon entries in html:
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="48x48" href="/favicon-48x48.png">
<link rel="icon" type="image/png" sizes="64x64" href="/favicon-64x64.png">
<link rel="icon" href="/favicon.ico">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="manifest" href="/site.webmanifest">