| YOU ARE HERE: HOME > WEB DESIGN ESSAYS > IMAGE OPTIMIZATION PART IV |
Optimizing Images for the Web - Part IVFour Factors you
Control
Dimensions For example, a quarter-screen image (1/4th of 640 x 480) would be 320 x 240 pixels, your HTML image tag would look something like this: IMG WIDTH=320 HEIGHT=240 SRC="my_image.gif"
Number of Colors You may be wondering how so many different colors can be displayed in your browser with such a limited option of colors for your browser to access. Take into consideration that color combinations are used to create colors that are not available in the palette (or something close). A good example would be an InkJet printer, most only use 3 different colors of ink (cyan, magenta, yellow) (some new models use 4 colors) to produce all of the different colors we see on our colored printouts. If you want to see "Number of Colors" optimization techniques in practical application you should try the following: Use your favorite search engine to find and download "LVIEW". Open a GIF image using LVIEW. Select "Retouch, Color Depth". Click the "Palette image button" and the "Custom Number of Colors button" and set the number of colors to 50. After you enter 50 in "Custom Number of Colors" click "OK". LVIEW calculates what mix of 50 colors will best represent your image. Compare the two files (before and after) and see if there is a noticeable difference. Try using different "Custom Number of Colors" settings to get the best match of colors and image quality with the smallest file size. You'll notice that saving the file results in a new file size that is dramatically lower than the previous. Since 1K equals about one second of transfer time, you could shave several seconds off of your image file download time.
Type of Compression JPEG is better at storing full-color photographic or gray-scale images, especially if you want your scenes to have realism and image depth. GIF is best used for black-and-white images or images with only a few, distinct colors (as opposed to color blends). It works well with line drawings, and graphics that contain text. If you are scanning pictures to use as images on the Web, you should consider the compression style used by either format. GIF gets rid of a lot of color information when it compresses. Compression ratios will range from 2:1 to 5:1. JPEG achieves 10:1 to 20:1 compression ratios easily on full-color images, and can go as low as 100:1 in some cases. When JPEG was first introduced, converting an image in GIF to JPEG could produce some very strange results. However up-to-date graphic conversion utilities can usually handle the conversion with ease producing eye-pleasing results. As a matter of fact, many of these utilities give tremendous customization control over the quality of the conversion. Nevertheless, you should decide which format you need when you originally create the digitized image and stick to it. However this is not always possible, especially if you're not the one creating the images. If you're just implementing the images into the Web page and not creating them you may have to work with an image file format that is undesirable. It may be necessary to convert the image into a more manageable and user-friendly (not to mention compatible) format.
Reusability This technique not only works with navigational bars and buttons but with graphical bullets and rules as well. You should avoid decorating your lists with bullets of all colors of the rainbow. Each bullet will need to be retrieved separately, multiplying the time it takes to render your page. If you use a single bullet image, the bullet will be downloaded once and re-used for each list item. This will be achieved in a much faster load time than downloading a different bullet for each menu item. It should be duly noted that using the same image also means the same image name. Often times when someone uses a WYSIWYG editor (what you see is what you get) to create Web pages the code generated by these editors will give strange names to page elements such as images. One such application that will remain nameless (MS Publisher, cough, cough) will assign numbers to images that have been cut and pasted, copied, or inserted onto a page (example: image1.gif). These types of applications will use this method of keeping up with images even if you paste or insert the exact same image multiple times during the creation of the Web document. You may end up with a bullet that is used throughout the site 47 times with 47 different names (example: image1.gif, image2.gif, etc.). If this sloppy design architecture is not cleaned up before the pages are loaded on the server you will end up with multiple copies of the same image under different file names. This will cause a users browser to download multiple copies of the same image which will totally negate your attempts at reusability. Therefore if you're using a WYSIWYG editor be sure you view all of your source code and edit it as necessary. Hand coding is a valuable skill and should be learned and practice fervently, (however, that's another topic). Go to Optimizing Images for the Web Part V ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ About the author... |