Favorites icon (favicon) file is placed in a web server root directory. It is a page icon or associated with a particular website. For example when you visit our site you see favicon in the browser’s URL bar, next to the site’s name. Also it appears next to the site’s name in lists of bookmarks, and next to the page’s title in a tabbed document interface.
There is a tool called ppmtowinicon which convert 1 or more portable pixmaps into a Windows .ico file You need to specify one or more portable pixmaps as input and it produces a Microsoft Windows .ico file as output. A Windows icon contains 1 or more images, at different resolutions and color depths. Microsoft recommends including at least the following formats in each icon (size and bits-per-pixel):
=> 16 x 16 – 4 bpp
=> 32 x 32 – 4 bpp
=> 48 x 48 – 8 bpp
How to create a favicon.ico with GIMP
You need to install netpbm – a graphics conversion tools under Linux / UNIX. You also need GIMP – the GNU Image Manipulation program to create a favicon on Linux.
Install netpbm and GIMP
Use apt-get command to install packages under Debian / Ubuntu Linux:
$ sudo apt-get install netpbm gimp
Step # 1: Convert logo to ppm raw format
- Open your logo using GIMP
- Now cut and paste logo in square
- Next resize logo by visiting Image > Scale image option. Set pixel size to 16 x 16 or 32 x 32 or 48 x 48.
- Next click on File > Save as > Enter file name as favicon.ppm > Click on Save > Raw Encoding > Ok
Step # 2: Convert portable pixmaps into a Windows .ico file
Now run the following command to create a .ico file:
$ ppmtowinicon -output favicon.ico favicon.ppm
Step # 3: Upload favicon.ico file
Upload favicon.ico file to webserver root directory such as /var/www/html or /srv/httpd/cyberciti.biz.
Step # 4: Favicon example
To activate favicon, modify your site pages or template by placing following code between <head>…</head> section:
<link rel="shortcut icon" href="/favicon.ico" />
🐧 2 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
@Binny V A: In general, that is true. AFAIK, Internet Explorer is the only browser that actually expects favicon.ico to be in Windows Icon format.
All other browsers use the mime-type (Content-Type header) or actual file contents to determine the format, and will generally display any supported image (maybe even SVG), so simply make sure your webserver is configured to send the correct mime-type for whatever favicon.ico format you choose, and Bob’s your Uncle!
I just convert it to GIF and rename it as .ico. Seems to work fine.