The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
Article Feedback - favicon.ico
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Previous Message  |  Next Message 
 How to make a favicon.ico under *nix
Author: Edwin Groothuis 
Date:   08-12-01 02:23

(This comment was originally submitted as a standalone article)

As described in <A HREF="http://www.freebsddiary.org/favicon.php">http://www.freebsddiary.org/favicon.php</A>, sometimes you see these entries in the logfile of your webserver:

"GET /favicon.ico HTTP/1.1" 404 3711

They're from people who bookmark your website (if they're using Internet Explorer) or if you have the following HTML code in your HTML pages (if they have Mozilla or Konquerer).

<LINK REL="SHORTCUT ICON" HREF="http://www.mydomain.com/favicon.ico">

Making such an icon is easy if you're using Microsoft Windows (just use PaintBrush and save it as a ICO file) and relative easy if you're using a Unix-like operating system.
This part is easy, or not, depending on your graphical skills. There are several tools available for this task. I used GIMP, it's available from the ports-collection.

The picture should be 16x16 pixels. Editing something that small can be tricky, but if you zoom in up to 1600% it will be easy to make a nice drawing.

If you save it, choose PNM format. It can be anything, but PNM will have the least problems for the next step.
After you've made the image, it has to be transformed into the Windows Icon format. The easiest way is to use Netpbm (available as a port in graphics/netpbm). If it was saved as an PNM file, the way to convert it into the Windows Icon format is with:

ppmtowinicon -output favicon.ico <inputfile.pnm>

If you had saved it as a different format, you should convert it from that specific format into PPM format first. For example, if it was in the PNG or GIF format:

giftopnm <inputfile.gif> | ppmtowinicon -output favicon.ico
pngtopnm <inputfile.png> | ppmtowinicon -output favicon.ico

There are more options available in Netpbm, like rescaling (pnmscale), cropping (pnmcrop) and rotating (pnmrotate). Very handy if you want to run batch jobs on your pictures, like making thumnails from your digital photos.
Now the easiest part and the one which shows of all the hard work. Add this line to the HEAD section of your webpage:

<LINK REL="SHORTCUT ICON" HREF="http://www.mydomain.com/favicon.ico">

And reload the page. In Mozilla it shows up in the address-bar. Netscape 4.7 doesn't support it. Konquerer does ask for them, but I don't have it so I couldn't find out where it shows up. Opera 5.0 doesn't support it. For Galeon I couldn't find it neither. Internet Explorer 5.0 does support it when you bookmark pages.

Keep in mind that it is a de-facto standard: there is no documentation about it on the W3C pages. If you want check if your browser supports it, have a look at <A HREF="http://www.mavetju.org/">http://www.mavetju.org/</A>, <A HREF="http://slashdot.org/">http://slashdot.org/</A>, <A HREF="http://sourceforge.net/">http://sourceforge.net/</A> or <A HREF="http://www.theregister.co.uk/">http://www.theregister.co.uk/</A>.

 Reply To This Message  |  Forum List  |  Flat View   Newer Topic  |  Older Topic 

 Topics Author  Date
 How to make a favicon.ico under *nix   new
Edwin Groothuis 08-12-01 02:23 
 Re: How to make a favicon.ico under *nix   new
Sevan 02-03-02 04:51 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org