Monthly Archives: November 2003

How To Create A Favicon

I’m going to make a confession: I can’t stand favicons. To clarify, I love the idea and the little icons on my Mozilla tabs are nifty, but I hate having to make them. This is partially due to working within the constraints of 16 by 16 pixels, but more so that until now I haven’t found a good way to generate said icons on Windows. I was jealous as a whip (can a whip be jealous?) when Noel posted instructions detailing how to do it on a Mac. For aforementioned reasons they weren’t applicable to me, so I set out to find a clean way to do this on Windows without spending any moolah.

At this point someone is probably wondering what in the world a favicon is. As far as I know, it’s not a standard of any kind (and if it was it’d be a badly implemented one) but it’s a widely supported feature in modern browsers that allows a site to specify a small graphic or icon to go next to its address in the address bar and theoretically as the icon for the page when it is bookmarked as well. (Some examples of favicons.) I believe Internet Explorer was the first to implement this. Due to popular demand there is a new photomatt.net favicon (you may need to reload that link directly to see it). To see it in Internet Explorer, bookmark this site (which you should do anyway). In Mozilla and its progeny you should see it just fine automatically, and possibly in Safari though I don’t have that handy to test. To see it in IE for Mac you need to sacrifice an Intel CPU and do a favicon dance. Actually I’m not sure why IE5/Mac has trouble with some favicons, at some point in the past I tracked it down to MIME issues, but it’s not really worth the effort anymore.

Another good reason to have a favicon.ico in the root of your site is some browsers request that file whether it is linked in your HTML or not, so if there’s nothing there it fills up your error logs. Since I watch error logs pretty closely this has always been an annoyance for me.

So what’s the trick to creating lightweight multi-size favicons? I used to use the online java tool the folks at favicon.com offered, but now they seem more concerned with making money than providing free tools. More recently I’ve used Icon Forge which I can easily say is one of the most awful programs I have ever used in my life. Truly horrid. I wouldn’t recommend anyone do that, so here’s the process I came up with. (Any excuse to use a nested list.)

  1. Download png2ico, which is a small, free utility for Windows, Linux, et cetera that works quite well. Extract it to c:/.
  2. Create an image you’d like to use at a decent size (at least 32×32 pixels) in your favorite image editor. I like Photoshop so here’s what I did there:
    1. Ctrl + N to start a new document. Choose 32×32 pixels for the size. Cram whatever you want to use in there, I choose a comic Josh did of me a while ago.
    2. Do a Save for Web (Ctrl + Alt + Shift + S) and save it as a PNG with the filename icon-32.png to the same folder as the program you just downloaded (to keep things simple). If you want to keep the size down I would recommend taking it down to 16 colors. Don’t forget transparency if you need it.
    3. Now go back and resize the image you’re working on to 16×16 pixels (Tools → Image Size [is there a shortcut for that?])
    4. Save this image as a PNG with the filename icon-16.png in the same directory as the above.
  3. Now it gets a little tricky, open up the command line. Try Start → Programs → Accessories → Command Prompt.
  4. Navigate to the folder where the png2ico.exe file is, if you followed the directions above you can use the command cd \png2ico.
  5. Now you just have to enter a command to roll those two PNG files you made into one nice ICO file. Here you go: png2ico.exe favicon.ico --colors 16 icon-32.png icon-16.png . You may be able to use command line completion (pressing a letter or two and then tab) to fill some of that in for you. You could potentially embed 64×64 and 128×128 pixel sizes into the icon file by just specifying additional PNGs of that size, but for a web favicon that really isn’t needed. Just remember this if you ever want to make a nice application icon. For an applicatoin icon you’d probably want to use a PNG-24 with full alpha transparency, which this tool supports as well.
  6. Now there should be an favicon.ico file in that same folder which you should upload to the root of your site and then link to it with something like <link rel="shortcut icon" type="image/ico" href="/favicon.ico" />
  7. Have a drink.

Now I know that sounds like a tricky process, but it’s actually not as hard as it may read and of course if you have any problems leave a comment and I’ll try to help you. There is supposedly a graphical front-end for using png2ico but it was so badly designed it’s actually easier to use the command line, as unlikely as that seems.

Update: Ian has found my favicon twin. Where have you been all my life?

Update 2: Oskar van Rijswijk recommends IrfanView in the comments. You might want to give that a try too.

On The Matrix Revolutions

It was a really, really great movie. Go see it. No spoilers here. 🙂 We were the very first people in the movie theatre, which was nice because we got the best seats. One of the times I saw Reloaded I had second row seats way too close to the screen and it was pretty miserable.

If you’ve seen it already, let me know what you thought. Spoilers are open in the comments.

Charles Platt on FCC

I got this via the Politech list and it absolutely made my day. From Charles Platt.

The FCC ruling pleases me in a way. Any shortsighted policy that discourages consumers from watching broadcast TV or raises the price of equipment for receiving broadcast TV is a step in the right direction from my point of view. Broadcast TV is an entrenched politically sanctioned zone of zero effective competition, with all the usual consequences. In addition I think it helps to make people stupid. Ideally it should be taxed into oblivion, but crippling it with DMCA measures is better than nothing I guess.

Of course even more ideally the FCC should be abolished and the airwaves should be auctioned, but that isn’t going to happen. Since government appears to be unavoidable at this time, it should behave as self-destructively as possible.

A good summary of the FCC ruling is available at the Washington Post.

Opera and Hallowe’en

Haven’t been around here much lately, though I have been posting to the WordPress blog, coding like crazy, and generally keeping busy. However there are two recent events I wanted to highlight. The first was attending the opening night of Julius Caesar with the lovely Elissa. The performance was excellent, though longer than I am used to, and I would recommend it. I saw several people I know from school there, which doesn’t happen often, but they all seemed to disappear after intermission. Did we miss the party or something? We stayed in our nosebleed seats all night, but apparantly the thing to do is scope out empty seats during the first act and grab them after intermission. Noted.

Elissa and I before we left We grabbed some fries beforehand.

The following night was the first official “party” I hosted at my new place, and it went well. Hallowe’en is my least favorite holiday, which isn’t to say I don’t like it, because it’s still a holiday, but as far as holidays go it’s the one I tend to enjoy the least. Anyway the party went well with food and candles and costumes and people I liked, and we ended up watching Ringu (the Japanese movie that inpsired The Ring), ordering pizza, and then by popular demand (with one dissenting vote) following it up with its American cousin, The Ring. Everyone had told me the Japanese version was supposed to be scarier and better, but I actually prefer the American version for a couple of reasons. Though things are less tidy, it’s more interesting and engaging. I hear a sequel is in the works. I didn’t dress up, but we did have one or two interesting ensembles.

Sarah and Elissa Patriq with Sarah's fake cigar Your author with bunny ears