# Documentation

favseed turns one SVG into an optimised favicon set. These pages cover installing it, running it from the command line, Vite, Astro or this website, and the files it writes.

## Install

To skip installing, [the generator on this site](https://favseed.cevdet.ch/) runs the same pipeline in your browser.

favseed needs Node 24 or newer and nothing else. Add it to a project:

```sh
npm install --save-dev favseed
```

Or run it once with `npx favseed`. The image engine, `@napi-rs/image`, installs with the package: resvg, oxipng and a quantiser in one native module, prebuilt for Linux, macOS and Windows on x64 and arm64, and FreeBSD on x64. Zopfli, which recompresses the PNGs, is bundled as WebAssembly, and the command line and this website share it. It is built from the same Google source as `@gfx/zopfli` 1.0.15, rebuilt with a modern LLVM; [bench/zopfli](https://github.com/cevdetch/favseed/blob/main/bench/zopfli/README.md) holds its source, toolchain checksums and build recipe. Zopfli finishing also tries a guarded lossless palette pass, and the [Vite PWA comparison](https://github.com/cevdetch/favseed/blob/main/bench/zopfli/COMPETITOR.md) records its byte savings and its speed, size and accuracy tradeoffs.

## Start in 30 seconds

### Command line

```sh
npx favseed logo.svg --out public
```

This writes five files to `public/` and prints their sizes. Add `--html` and it also prints the `<link>` tags for your `<head>`:

```html
<link rel="icon" href="/favicon.ico" sizes="48x48">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
```

[Command line](https://favseed.cevdet.ch/docs/cli) lists every flag, and [SVG input](https://favseed.cevdet.ch/docs/svg-input) what your source needs.

### Vite

```js
// vite.config.js
import { defineConfig } from 'vite'
import favseed from 'favseed/vite'

export default defineConfig({
  plugins: [favseed({ input: 'src/logo.svg' })],
})
```

`vite dev` builds the icons the first time a page asks for one and serves them from memory. `vite build` writes the release icons next to `index.html`. favseed adds its `<link>` tags to `index.html` unless the page already has a `<link rel="icon">`. [Vite plugin](https://favseed.cevdet.ch/docs/vite) covers the options and vite-plugin-pwa.

### Astro

Put your SVG at `src/logo.svg`, then run this from your Astro project:

```sh
npx astro add favseed
```

Astro installs the package and adds the integration to `astro.config.mjs`. The `<link>` tags go into every page that does not already have a `<link rel="icon">`. [Astro integration](https://favseed.cevdet.ch/docs/astro) covers the options, caching and head tags.

### Website

Open [the generator](https://favseed.cevdet.ch/), choose an SVG and download the set as a zip. The build runs in a worker in your browser tab, so nothing is uploaded, and you can cancel it. At the default and maximum efforts the page shows a quick set first, the `--effort fast` files, ready to download, and replaces it with the final set when the search ends. Progress counts each encode, and each file shows the setting it kept.

The page includes a manifest; use `--manifest` for the matching CLI set. The [site's README](https://github.com/cevdetch/favseed/blob/main/site/README.md) lists the browser requirements and measurements. If the generator will not start, [Troubleshooting](https://favseed.cevdet.ch/docs/troubleshooting#common-problems) lists what the browser needs.

## What you get

| File | What it is |
|---|---|
| `icon.svg` | One optimised SVG for the favicon and page images. Animation, styling and accessibility are preserved by default. |
| `favicon.ico` | One 48×48 entry, stored as a raw PNG in a 22-byte container. |
| `apple-touch-icon.png` | 180×180 on the `--bg` ground, the mark placed in the safe zone so iOS's rounded mask cuts nothing. |
| `icon-<size>.png` | On the `--bg` ground, the mark placed in the safe zone the same way. Default 192 and 512, the pair Chrome's install criteria document. The manifest's `any maskable` icons. |
| `site.webmanifest` | Only with `--manifest`. Icons only: you merge your own `name` and `theme_color`. |

Use the same `/icon.svg` URL in `<link rel="icon">` and `<img>`, so the browser can reuse the cached file. PNG and ICO exports use the source's static base appearance. [Outputs](https://favseed.cevdet.ch/outputs) covers every file in detail: its size, its format, the markup it needs and which platforms read it.

## The pages

- [Command line](https://favseed.cevdet.ch/docs/cli): every flag and its default, the config file, `--var`, `--bg`, `--padding`, the effort levels and how files are written.
- [SVG input](https://favseed.cevdet.ch/docs/svg-input): the viewBox your source needs, text and images, dark mode and animation.
- [Vite plugin](https://favseed.cevdet.ch/docs/vite): icons from memory in dev, emitted in the build, with vite-plugin-pwa.
- [Astro integration](https://favseed.cevdet.ch/docs/astro): setup, options, caching and head injection.
- [Node API](https://favseed.cevdet.ch/docs/node-api): `build()`, `buildFiles()`, the TypeScript types and the portable core.
- [Troubleshooting](https://favseed.cevdet.ch/docs/troubleshooting): common problems and how to upgrade safely.
- [Guides](https://favseed.cevdet.ch/guides): the minimal favicon set, maskable icons and dark-mode favicons.
- [How it works](https://favseed.cevdet.ch/how-it-works): the steps from one SVG to the finished set, from SVG optimisation and safe-zone placement to the accuracy bar and Zopfli.
- [Outputs](https://favseed.cevdet.ch/outputs): each file favseed writes, the HTML it needs, and which browser or platform reads it.
- [Compare](https://favseed.cevdet.ch/compare): favseed next to favicons, astro-favicons, the Vite PWA assets generator and RealFaviconGenerator, on features and on one benchmark run.
- [Benchmarks](https://favseed.cevdet.ch/benchmarks): measured bytes, accuracy and build time behind favseed's defaults.
