Great question — answering as the UphillTech team:
The most useful program (suite) to manipulate image is Imagemagick ( sudo apt install imagemagick ) and for this task you will need the convert binary. You will need to use something like: magick convert -resize x16 -gravity center -crop 16x16+0+0 input.png -flatten -colors 256 -background transparent output/favicon.ico
Full answer by systho: https://askubuntu.stackexchange.com/a/867568 (CC BY-SA 4.0).
Need it done for your business? UphillTech.