You can quickly generate favicons on *NIX systems with ImageMagick installed (apt install imagemagick on Ubuntu systems). For legacy support, use favicon of size 16x16 or 32x32.

The format for the image you have chosen must be 16x16 pixels or 32x32 pixels, using either 8-bit or 24-bit colors. The format of the image must be one of PNG (a W3C standard), GIF, or ICO.


First generate favicon.png:

convert input.png -thumbnail 16x16 -alpha on -background none -flatten favicon.png

Then generate favicon.ico in various sizes for legacy IE support:

convert input.png -define icon:auto-resize=64,48,32,16 favicon.ico

HTML 5 doesn't restrict the favicon size, so you are free to set any favicon size if you don't require lagacy support. While you're at it, you can also add for Apple devices:

<link rel="apple-touch-icon" href="touch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="76x76" href="touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="120x120" href="touch-icon-iphone-retina.png">
<link rel="apple-touch-icon" sizes="152x152" href="touch-icon-ipad-retina.png">

Finally, ImageMagick doesn't come with built-in svg support. You'll probably get delegate failed '"rsvg-convert" -o "%o" "%i"' if you use a svg icon as input. If you want to use svg pictures, you need to install librsvg2-bin (apt install librsvg2-bin).