Readers have been asking me how to make their graphics load faster. Here are some tips; I’ll have more next week.
• Properly “describe” your graphics.
This first trick is very simple; you don’t have to change your images one bit. Simply make sure both the height and width of the images are included in their description, and make sure they are accurate. You need to do this on every single image, even if its a one-pixel GIF.
Why? Because your computer “draws” the page on your browser as it downloads. If the height and width aren’t specified, the computer will hold random space for the image until the download is complete, then redraw the whole page to fit the actual size of the graphic.
Placing height and width descriptions on all your images will significantly speed up your site, and make your site look better as it loads for your visitors.
• Ruthlessly “compress” your file sizes.
We’ll approach this as if you already own Photoshop, Fireworks, ImageReady or a similar graphics program. If you do, here’s the story.
For GIFs, make sure to save the image with the fewest possible colors in the “adaptive” palette. Use your “color picker” to eliminate unnecessary colors in the indexing process. Use your “lasso” to select the most critical, detailed areas of the image first.
This trick alone will often cut 5K from a file size by allowing you to use 16 colors instead of 64 colors. Never use all 8 bits (264 colors) for a simple graphic.
For JPEGs, make sure to save the image at the lowest quality you can live with. I usually start with “1” and work up to “3” if necessary. If you’re using Photoshop, be sure to “close” the JPEG and re-open it in order to view what it will actually look like on your Web page.
A client recently contacted me because he was concerned his graphics were too slow and were costing him sales. He was right. His homepage graphics totaled 167K, not even counting the text!
Try to keep your total homepage graphics under 20K, and your entire page, including text, under 40K.
If you don’t have Photoshop, or don’t have time to learn to use it, here’s another way to minimize file size.
For about $60 a year, you can subscribe to an online graphics service that can double or even triple the efficiency of your graphics. You simply enter the location of your image, whether on your hard drive or online, and you instantly get a selection of optimized images which you can save and use.
Alternately, for about $90 you can purchase a software package called Net Graphic Optimizer that performs the same function. If you manage a lot of graphics, this is the tool you want. It allows you to decrease the size of an image, and view it in real time so you can see at what point it degrades. Compress those images “it hurts,” and you will see your site speed improve dramatically.
• Speed up your HTML.
The next-quickest way to speed up your Web site is to learn a little bit about HTML, or “Hyper Text Markup Language.” HTML is the coding behind the scenes of most pages. Some of it is quite technical, but a lot is pretty darn easy.
Did you ever go home for Christmas and get stuck talking with Uncle Bob who bored you to death with stories you’d already heard over and over? Well, sloppy HTML works the same way. HTML gives “instructions” to your computer. It tells your computer how to turn the code into the colors, pictures, sounds and words which then appear as a Web page. Poor HTML frustrates your computer, needlessly repeating itself, just like uncle Bob.
Some of the most common speed-suckers in HTML are those extra repetitions of “style tags.” For instance, both Claris and Microsoft FrontPage like to put style tags on almost every line of text, even if the style hasn’t changed at all, like this:
<p><small><font face=“Arial, Helvetica”>Welcome!</font></small></p> <p><small><font face=“Arial, Helvetica”>Nice to see you...</font></small></p> <p><small><font face=“Arial, Helvetica”>Please order now.</font></small></p>
With all due respect to Microsoft, that’s a lot of code for such a simple task! You don’t need the code to repeat the font face and size “style tags” every time. You only need them once at the beginning, and then once to close the command, like this:
<p><small><font face=“Arial, Helvetica”>Welcome!</p> <p>Nice to see you...</p> <p>Please order now.</font></small></p>
That may not seem like much, but over the course of a 300-line sales letter, this could add up to an extra 10K of file size, resulting in a page that takes perhaps 5 seconds longer to load.
Comment tags can be extra too, not to mention the totally worthless code that a lot of software will automatically place at the top of your META tags, promoting itself while doing nothing at all for the rest of your page.
Consider learning enough HTML to be able to go in and delete this “fluff” from the source code of your pages. Its fun and rewarding to see the improved performance of your faster— and more profitable— site.
Russell Case is the president of CaseTek, a Santa Clarita firm specializing in high-tech Internet and e-marketing solutions for businesses and professionals. He can be reached at 294-2424 or [email protected] . His commentary appears on Thursdays.
