parsed.org

Tips by tag: icon

To create a .ico file that can be used for the favicon.ico on webpages, you can use a nice little program called png2ico. There is no package for this in Debian or Ubuntu so you will need to compile it yourself. Compilation is very straightforward. You do need a libpng package. Most of the time it will be installed but if you see an error, just searching for that file will yield the package you need to get for your distribution.

The session below uses /usr/local/src for the compilation and installed to /usr/local/bin. It can be compiled anywhere and installed anywhere, but having it in your $PATH makes things easier:

$ cd /usr/local/src
$ wget http://www.winterdrache.de/freeware/png2ico/data/png2ico-src-2002-12-08.tar.gz
$ tar xvzf png2ico-src-2002-12-08.tar.gz
$ cd png2ico
$ make
$ sudo cp png2ico /usr/local/bin/
$ sudo cp doc/png2ico.1 /usr/local/man/man1/

Once compiled, upload your png images. They should be square; sizes 16x16 and 32x32 are suggested. To create the icon you would then call the following:

$ png2ico favicon.ico your_favicon16x16.png your_favicon32x32.png

Afterwards you will then have a favicon.ico file. You then place this in the webroot of your website add the following to <head></head> section of your webpages:

<link rel="shortcut icon" href="/favicon.ico" />

It's good form to include it, but most common browsers automatically look for an icon at that location.

commandsconvertfaviconiconimagepng2icoshellweb
RSS