Illustration: Metropolis by Rob Porazinski from www.artville.com Web Graphics Basics

by Mark Bakalor

Good web sites require a seamless integration of text and graphics. Here's the least you need to know about web graphics.

  • Introduction
  • Format: Save "simple" images as GIFs and "photographic" images as JPGs.
  • Size: Images should be saved at a resolution of 72 dpi and should be no wider than 600 pixels.
  • Color: The more bits you use per pixel, the finer the color detail and larger the file size you'll get.
  • Jaggies: Fix the jagged appearance by anti-aliasing curved shapes and text.
  • Background: Stop the "halo effect" by designing your graphic over your site's background color.

Years ago, the Web was little more than black text on a gray background. The infrequent graphic took about three weeks to load, it cost three cents to buy a loaf of bread, and I had to sludge through seven feet of snow just to get to school. Times have changed, the snow has melted, and the Web has become a place where visitors expect slick, professional graphics.

But if you don't know how to take advantage of the Web's potential, history will repeat itself: Your creation will take three weeks to download and a note will be sent home telling your parents that you're just "not living up to your full potential."

PixelsThe first step in understanding how to create and manage graphics for the Web is understanding the graphical image itself. Electronic images are made up of thousands of tiny colored dots called "pixels." The pixels are so small they can't be detected individually by the human eye, so they create the illusion of a continuous image. This is how all images you see on your computer (and TV) work. Surely you held a magnifying glass up to the TV screen when you were a child. If not, go and try it right now. Some screens have dots, some have lines, but the principle is the same.

So, read on, and I'll help prepare you to handle your pixels properly.

Web formats

Web browsers can only display graphics saved in special file types. The two main graphics formats used are the GIF and JPG.

It's important to know the differences and choose the best format for each image, so that pictures are as compact as they can be so they show up on your site visitor's screen as quickly as possible.

How long? To figure out how long it will take for someone to see a web page graphic using a 28.8 modem (the most common speed), divide the file size by two. So a 12K file will usually take about six seconds to download and view.

GIF: Graphic Information Format

(pronounced "jiff")

  • GIF files are best for images with fewer, flatter colors. Use this for "presentation graphics" type images: charts, graphs, or text set as graphics. The fewer colors you use, the more efficient GIF files are.
  • GIF files can contain up to 256 colors.
  • GIF files can be "interlaced" so they appear to fade in, from lower to higher quality, while loading. This gives your visitors something to look at while they're waiting.
  • GIF files can be transparent. This means you can select one color to "not show" causing your browser's background color to show through. This keeps your graphics from looking as if they're in boxes and visually makes them more a part of the page.
  • GIF files are "lossless," which means the image quality is not degraded by the compression process.
  • Animated GIFGIF files can be animated. Just like motion pictures, only much simpler, animated GIFs simulate motion using a series of individual images.
  • GIF files are not good for photographs—you lose quality and the files won't be compact. Use JPG files for photos.

JPG: Joint Photographic Experts Group

JPEG, (pronounced "jay-peg" and often referred to as "JPG")

  • JPG files are best for images with many colors, such as photographs or scanned artwork. JPG allow s for up to 16 million colors.
  • JPG compression is variable. You can apply more or less compression to each individual image.
  • JPG is a "lossey" system. The more compression you apply, the more quality you lose. While file sizes can be made quite small with this system, you often have to compromise between file size and picture quality. Newer graphics software allows you to preview your JPG images, so you can choose the best compromise between quality and file size.
  • Newer versions of this type introduce the possibility of saving your JPG as an interlaced file so it appears to fade in, from lower to higher quality, while loading, but older browsers don't all support this format.
  • JPG files are not good for graphics with only a few colors, such as text set as graphics or graphics with areas of flat colors. If you use JPG for these graphics, they will be larger than necessary, and look "mottled."

PNG: Progressive Network Graphics

  • PNG is the newest graphics file format for the Web, but it's only supported by newer browsers. These files will not appear in older browsers, so using this format will cause some of your site visitors to be unable to see your graphics
  • PNG files are compact and versatile and can combine the best features of GIF and JPG, such as the ability to have transparent backgrounds or the ability to contain images with millions of colors.
  • Despite this, the PNG format is still not widely used, mostly because it's not supported by older browsers. While it's an efficient and useful file format, you may want to hold off using it until fewer people use older browsers.

When to use which?

The most common graphics mistake people make on the Web is to use the wrong file format for their images. But the choice is really quite simple:

  • If a graphic has few colors, choose GIF.
     
  • If a graphic has a lot of colors (such as a photo), choose JPG.

That's it.

Choosing the right format can ensure that your graphics look good and appear quickly on your visitor's computer. Choosing the wrong format makes your graphics look bad and take forever to download. So if you can't remember these two simple rules, then consider having them tattooed somewhere on your person.

For the sake of discussion, let's separate all possible image content into either photographic or simple categories. A simple image generally consists of text, charts, and diagrams, anything with sharp edges or large bodies of continuous color. A photographic image can be anything from a picture of your pet, Sigmund the Wonder Dog, to a painting, basically anything with a large amount of noncontinuous colors. As a general rule, "simple" content should be saved as GIF files and "photographic" as JPG files.

Diskettes saved as JPG with too much compressionDiskettes saved as GIFThe images in this paragraph demonstrate the give and take struggle between file size and image quality that you will find yourself dealing with often. This image is correctly saved as a GIF in the left image and incorrectly on the right as a JPG. They are equal in file size, but it is easy to see which wins out in the quality race--GIF is better for non-photographic images.

But JPG is virtually always more efficient (and better looking) for photos, as seen below. But JPG file sizes and image quality can vary, so you need to understand a little about JPG compression.

rick-80 

rick-30 

rick-10 

JPG quality 80,
file size 10K

JPG quality 30,
file size 5K

JPG quality 10,
file size 3K

rick 

GIF, 12K

JPG compression and file sizes: If uncompressed, this image would be almost 100K. When saved as a JPG with quality set to 80, the file is reduced to 10K. Raising the JPG compression to 30 (middle image) gives you a file that's only 5K, yet the loss of quality is not too obvious. The image on the right is saved with JPG compression set at 10, and while the file is only 3K, there is a clear loss of image quality. In this case, it's worth the extra 2K (1 second) of download time to use the image with 30 compression rather than 10 compression. The image on the right was saved as GIF, not only is it larger than it needs to be (at 12K), but the quality is also not as good. While you can get good quality photos from GIF files, the file sizes will be much larger than JPG files of the same images. In this case, a GIF version that looked closest to the JPG/80 image would be 29K, three to six times bigger than necessary (which means it would take three to six times longer to download than necessary).

Compression and quality will vary from image to image, so it's best to use software that gives you a preview before you save—this allows you to experiment with various levels of compression to choose the best compromise between quality and file size.

About JPG compression numbers: Different programs use different numbers for JPG compression, but generally, the higher the number, the higher the quality and the bigger the file size. You may need to look at the on-line help for your software to figure out its JPG settings.

Your original graphics files

While you must use either GIF or JPG on the Web when you're creating graphics, you should save your original work in a format such as TIF (Tagged Image File Format) or the native format of your graphics program. Why? Because both GIF and JPG compromise image quality for the sake of compression.

Resolution

If deciding individual file types to save your images in isn't the most misunderstood concept in Web design, resolution is.

The number of pixels that can be displayed on the screen is referred to as the screen resolution. The greater this resolution, the more pixels that can be displayed, which allows for more to be shown on a monitor at once.

But, and there's this give and take when we deal with on-line design, pixels are smaller at high resolution and detail can be hard to make out on smaller screens. As a rule, graphics for the Web should be no larger than approximately 600 pixels wide as most people view the Web at a screen resolution of 640x480. Graphics wider than 640 won't fully display without the annoying left and right scrolling.

When designing for the Web, resolution greater than 72 dpi (dots per inch) is a waste. There is no benefit to higher resolutions as computer monitors are unable to display them any better. Files will be larger and take longer to download, but the image quality on screen will not be better.

Finally, it can be confusing to think about resolution at all—so it's best just to think about the size of your graphic in terms of pixels. When you create a graphic, your graphics program should be able to tell you how many pixels tall and wide it is—that's what is really important.

Color "depth"

Each pixel of your on-screen image is displayed on a monitor using a combination of three color signals: red, green, and blue. The intensity of these signals determines its appearance.

On a black and white TV or monitor, pixels have only two possible colors: black or white. That's called "1-bit" because the pixel is either on or off.

On color monitors, it gets more complicated. Each pixel can display a number of colors, from 16 (4-bit) to 16 million (24-bit). Most computer monitors today can display 256 colors (8-bit) per pixel. Newer computers routinely display 65,000 (16-bit) to 16 million colors.

Because most of your Web visitors' systems display only 256 colors, that's the number of colors you should design for. This doesn't apply to photos, however, which should always be saved as 24-bit JPG files. To learn more about color and Web graphics, see Lynda Weinman's WebColor articles.

Anti-aliasing

Because images are created using pixel, gridded squares, images that aren't square can appear jagged. The distinct division between pixels is called "alias," so many graphics programs use a technique called "anti-aliasing" to create the illusion of smoothness.

Curved shapes and text should always be anti-aliased to maintain a clean and presentable look. The give and take bares its ugly head, yet again, requiring more colors to create the smooth look.

In the image below, you'll see the difference between aliased (left) and anti-aliased (right) text.

dwh-alias 

dwh-alias-on 

The "halo effect"

Transparency can only replace one color shade. If your GIF has a background that is much different from where it will appear, making the background transparent will leave what is known as a "halo effect" around the object after anti-aliasing:

dwh-halo2 

To fix this problem, design your graphic over a background color close to your Web page background, export an anti-aliased version, and then define the background color as transparent.

dwh-halo-2no 

Knowing your limitations

Good graphics on the Web are always a compromise between how good a picture looks and how long it takes your Web visitor to download and see it. But if you keep this in mind, you can create fast, good-looking graphics.

To read more about graphic software, what they do, and which one would be best for what you´re doing, click here.

b-line 

About the author

mark-bakalorMark Bakalor is the lead designer for hijinks design.

Illustration: Metropolis by Rob Porazinski from www.artville.com

 

[Home] [Start Here] [Plan] [Design] [Build] [Grow] [FuseLetter] [New]

SITE MAP - Contact us - Legal Info
www.efuse.com ©2000, NetObjects

Sign up for our free FuseLetter!

BuiltByNOF

bulletTry NetObjects Fusion for free
bulletBuy  NetObjects Fusion 4 for $49
bulletBuy FusionMX for $99

Learn about NetObjects Training Classes

fuseman