favicon.ico Creation and Screen Captures on Linux

There are several tools and processes I’ve been wanting to make the subject of Weblog posts, but keep I forgetting about them until something comes up that makes me wish I wasn’t so lazy about such things. Two popped-up again yesterday.

Last night, the sometimes mystical process of creating favicon.ico files for websites without the use of commercial tools came up as I was helping my wife put together a site for an organization with which she works. I often forget this process, as there is no built-in way to do this using my favorite image editor, The GIMP, directly. So, this post is primarily a breadcrumb for myself, but doubles as a useful tech tip for anyone else searching for ways to create these files easily.

Earlier yesterday, I happened to notice someone entered the search engine keyword phrase, “linux ppc screen capture”, which is an almost monthly phenomenon, and results in a link to my (very) old Gentoo Linux PPC Screen Capture page. While this is pretty and all, it probably isn’t particularly useful for someone looking for ways to create screen captures (a.k.a. screenshots) on Linux. I always hate to be disappointed upon visiting a search engine result myself, so I endeavor to minimize that disappointment in others as they navigate to our site.

favicon.ico 101

What is the favicon.ico file?

A great question! The favicon.ico file is a graphic image that can be used to iconify your webpage in web browser bookmark entries, and in the path bar in some web browsers. You may have noticed cute little graphics just to the left of the URL path in Firefox, or to the left of the site name in your Bookmarks / Favorites in Firefox / Internet Explorer.

Why should you care about having a favicon.ico file?

Another splendid question! Aside from adding a little style to your site visitors can appreciate, the addition of this file can also decrease the size of your web server’s error log file. That’s right, not having a favicon.ico file results in “404 Not Found” errors everytime someone with a modern-era browser visits pages on your site. By default, most browsers now look for the favicon.ico file in the webroot (same level as the main index page) of your site, and the act of requesting something that does not exist creates the 404 error.

How can one easily create the favicon.ico file without the use of commercial software?

Now, that’s the best question of all! There are two methods, both of which require you to create your desired graphic as a 16×16 pixel image, a 32×32 pixel image, and optionally, as a 48×48 pixel image using image editing software.

Once you have your images in GIF, JPG, PNG, or BMP format, you can use the first method of using the online Dynamic Drive FavIcon Generator. You simply check the appropriate boxes, browse to the sized image files, and click on “Create Icon”. Pretty simple.

The second method is slightly more involved, requires you use the PNG format for your sized image files, and involves the Open Source tool png2ico, which is available for Windows and other platforms (like Linux in my case). With the tool in place, creation of the favicon.ico file was a simple matter of entering the following from the command-line working in the directory where the sized images reside:

png2ico favicon.ico image_16x16.png \
                    image_32x32.png \                
                    image_48x48.png

Place the resulting favicon.ico file in your webroot, and you should be in good shape. You can also now add the following to the header portion of your web pages:

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

OK. Now, you know how to create the favicon.ico file…but I just recently read that the use of the ICO format for the favorites icon on the web is no longer a “best practice”. Instead, using a single PNG image is now recommended, and can be associated with your pages using the same link format as above:

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

Although I have not tested this, I assume that if you use a 32×32 or 48×48 pixel PNG image, it will automatically be resized appropriately for use when the 16×16 size is required. Salt to taste.

Quick, Easy Screen Capture from Linux

There are probably many, many, many tools for grabbing screen captures out there, and probably a great many of them are Open Source. I have to admit, I haven’t done a lot of shopping. I found a tool that I like, and that’s what I’ve been using for years. The tool, part of the ImageMagick collection of tools, import, is my first and only choice. ImageMagick is included with most Linux distributions as an available package, and is also available for the Windows Cygwin(probably only for use with Cygwin X) and OS X environments.

To bring up “cross-hairs” for capture selection, simply type this at the command-line:

import selection.png

The image format can be any of the ImageMagick supported formats (the usual suspects, plus some unusual ones), and is interpreted by the application intelligently based on the filename extension you provide with the file name.

To capture just a window, use the “-window id” option, specifying the window manager’s name for the window as the capture id:

import -window "Google - Mozilla Firefox" window.png

To capture the entire X screen, use the “-window id” option, declaring the root window as the capture id:

import -window root screenshot.png

If you use GKrellM as a graphical system monitor for your Linux box, look for the GKrellShoot plugin. Along with proving an easy GKrellM-based means of launching a screen lock, it also provides a click interface to calling ImageMagick’s import tool for screen captures.

Until next time…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: