ImageMagick favicon and icon set generator
Create a multi-resolution favicon.ico from a PNG with ImageMagick using icon:auto-resize, plus the app icon sizes iOS, Android and PWAs expect.
Multi-resolution favicon.ico
magick logo.png -background none \
-define icon:auto-resize=16,32,48,64,128,256 favicon.ico
icon:auto-resize packs every listed size into a single .ico file, which is what browsers and Windows both expect. Start from a square source of at least 256×256 — ImageMagick downscales cleanly but cannot invent detail going up.
256 is the ceiling
The ICO format does not support dimensions above 256×256. Listing 512 will either be ignored or produce a file some Windows versions refuse to read. Converting a large image straight to .ico without auto-resize fails outright:
convert: width or height exceeds limit `favicon.ico'
Which sizes do you actually need?
| Size | Used by |
|---|---|
| 16×16 | Browser tab, bookmarks bar |
| 32×32 | Taskbar, high-DPI tab |
| 48×48 | Windows desktop shortcut |
| 180×180 | iOS home screen (as a PNG, not in the .ico) |
| 192 / 512 | Android and PWA manifest (PNG) |
16, 32 and 48 inside the .ico covers the browser cases. The larger app icons must be separate PNG files referenced from your HTML or web manifest.
Generate the PNG app icons
for s in 180 192 512; do
magick logo.png -background none -resize ${s}x${s} \
-gravity center -extent ${s}x${s} icon-${s}.png
done
Design note: 16×16 is not a small logo
Detailed logos become mud at 16 pixels. If your mark has thin strokes, gradients or text, make a simplified variant — usually a single letter or the boldest shape — and use that for the small sizes:
magick logo-simple.png -background none \
-define icon:auto-resize=16,32 favicon-small.ico
magick logo.png -background none \
-define icon:auto-resize=48,64,128,256 favicon-large.ico
Referencing it
<link rel="icon" href="/favicon.ico" sizes="any">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/icon-180.png">
Modern browsers prefer the SVG when one is offered, falling back to the .ico. An SVG favicon scales perfectly and is usually smaller than the icon set it replaces.