GIF's, JPG's, TIF's, AND OTHER 3 LETTER WORDS
Understanding Graphic File Formats
by [unknown]


You've seen them, either in your graphics software or perhaps on the Internet, you know they make nice little pictures on your screen, but why so many different ones ? What's the difference anyway ? Believe it or not, there are differences between the file formats, and here we will attempt to explain them. This article will not be an engineering paper, but more of a basic description of each of the popular file formats and how they work. In addition, we will be discussing graphic files as they pertain to screen displays only and leave the printing dilemma for another discussion.

Color images displayed on your screen are displayed as pixels. Your monitor can be set to display different resolutions of these pixels. For example, a monitor set to 640 x 480 will display 640 columns and 480 rows of pixels, or a total of 307,200 pixels. Other common resolution settings are 800 x 600, 1024 x 768, and some monitors and graphic cards can display even larger resolutions.

Then, there is color depth. Color depth means the number of colors that can be displayed by your monitor. The term 'bits' is used for this. For example, a 1 bit depth would only be capable of on and off, as in black or white. A depth of 8 bits would be capable of displaying 256 colors, or 2 to the power of 8. A depth of 24 bit would mean 2 to the power of 24 or 16 million colors.

Your monitor and graphics card will dictate at what maximum resolution and color depth you can display an image, but a video card with 4 megs of RAM can usually display 1024 x 768 at 24 bit color. When we save a image, we need to choose a file format. Since there a few to pick from, let's discuss how they differ and which ones are appropriate for your job at hand.


The TIF File ------------

The TIF format, also known as The Tagged-Image File, is a file format that is common to many graphic programs. Almost every graphics program will read a file saved as a .TIF in both the PC and Mac world. The TIF file will save the information for each pixel in the image and is capable or saving color depths of 1 to 24 bit. A TIF file can be saved without image compression, therefore, it can be saved over and over without losing any of the detail in the image. The downside of this format is the file size. If you have a 24 bit image that is 640 x 480 in resolution, the TIF file format will result in a file size of 900k. An image with a resolution or screen size of 800 x 600 will be 1.37 MB, and an image of 1024 x 768 will result in a file size of 2.25 MB, too large to fit on a diskette.

Since the TIF file saves each pixel and all the color information for each, the file sizes are the largest of the formats discussed in this article. Some graphics programs provide compression called LZW for TIF files which will reduce the file size depending on the picture content. If you use LZW compression for a TIF file, it will save you disk space, but be careful, not all programs can decompress the file.

The TIF file is an excellent format for graphics as far as quality is concerned, but because of its size, it is rarely used within the online world. Downloading 2.25 MB to see a 1024 x 768 full screen image would be rather cumbersome. It is still the file format of choice for any type of professional graphics work where one might need to have an image printed in a magazine, since just about anyone working in the graphics world can read the file, and its uncompressed format allows for multiple saves without losing any information.


The GIF File ------------

The GIF format was created by CompuServe and stands for Graphics Interchange Format. This format was created to reduce the file size and make it possible to exchange graphics files over modems.

For many years, this was the file format of choice for most online services such as CompuServe, BBS services, and the Internet. GIF files can save color depths of 1 to 8 bit, but no more.

Therefore, any file saved as GIF file will be limited to using 256 colors. For many years, a monitor that displayed 256 colors was state of the art, therefore, this file format was perfect for most people downloading graphic files.

A GIF file compresses the image to reduce the file size. The compression works something like this: When a GIF file is created, a color index is also created which stores the colors used in the image. For an 8 bit file, this index shows the 256 colors used in the image and can be viewed and edited using graphics editing packages. Instead of saving the color information for each pixel on the screen like the TIF format, the GIF file stores the information as to where each of the 256 colors go. This may not seem like it saves space, but when you consider that an 800 x 600 file contains 480,000 pixels, each of the 256 colors has to be repeated a number of times within the picture. Rather than storing information about each of the 480,000 pixels, we can now store only 256 colors, and a 'program' to tell us where in the map each of the 256 colors belong. An example of the size savings would be if you had to write a program to print the numbers 1 to 480,000. You could either enter all 480,000 numbers one at a time, or you could have the program put in a 1, then tell it to add 1 for each cell till it gets to 480,000. Obviously, the adding program would take up a lot less space than storing all 480,000 numbers. So it is with the GIF file.

GIF file sizes will vary depending on the way color is used in the picture. For example, a 640 x 480 file which is all one color will result in a file size of less than 1K, roughly, about 900 bytes. This is because the GIF file would save just the one color used in its index, and the information to use it in each of the 307,200 pixel locations. The more complex the use of the 256 colors, the larger the file size will become. The GIF will always be less than the TIF file in size. GIF's only have to store 256 colors and save space for every location that a color is used more than once.

The one color TIF format would still take up the full 900k since each pixel must be stored individually. Since the GIF file compression is set to this index of colors, the format is sometimes referred to as 'indexed color'. Also, since it is a compression scheme that keeps the information for each pixel, no loss occurs when saving the file multiple times. This format is good for any picture which is limited to the 256 colors, and when compressed file size is the goal.


The JPG File ------------

This is the file format which seems to enjoy the most confusion. Many people are of the opinion that the .JPG format or JPEG which stands for Joint Photographic Experts Group, is simply a way to make a file size smaller. Indeed, the JPG is capable of high compression, but there is much more to it. The JPG format is capable of saving up to the full 24 bit color depth, or 16 million colors. This gives it a big advantage over the GIF format which is limited to only 256 colors.

The JPG format utilizes compression in a different way than the GIF format. The JPG compression scheme actually discards data that it deems as non-essential to the image. For example, if two pixel locations both have an identical color dot, then the JPG will only save one of them and "remember" to put the identical one in the other spot. It only needs to save the color information for one of the two pixels. In many pictures, large blocks of the same color allow the JPG to discard all the pixels in that block of color except for one. Programs which save to the JPG format generally allow the user to decide at what level of compression the picture is to be saved.

Theoretically, at the highest quality setting, the compression would only discard those pixels which have the same color as others or have a color which is indistinguishable from another to the human eye. By using higher levels of compression, the user could drop more information in which case colors which are "almost" the same would be dropped and replaced with the same color.

JPG's compressed at high quality settings will virtually appear to be the same as the original but reduce the file size by between 5:1 to 15:1 depending on the color complexity of the image. If the whole image is one color, the compression will result in a very small file size. If an image contained a different color for each of the 307,200 pixel locations, the compression would not save as much on file size without dropping some of the colors in favor of duplicates. The compression ratio or quality setting will determine how similar a color needs to be before it is discarded.

Now here's the tricky part. Since the compression is applied when the image is saved, the picture once reloaded or "decompressed" is no longer the same as the one that you originally had on your screen. This is referred to as "lossy" compression. This means that if you save or compress the picture again, the compression will again be applied and could result in further pixel information being discarded. If you were to continue to re-save the JPG many times, you would eventually have an image that would be highly degraded in quality. The JPG format is not meant to be a file format used to edit and save over and over, it is meant to be a format once a file is finished and final.

This is why so many JPG files on the Internet can appear grainy and poor quality. It is not the file format nor the originator who may have caused this, but people downloading and re-saving multiple times. Additionally, many JPG files on the Internet were once GIF files. This means that the originator took a color scan that was probably in its 24 bit color format, and reduced the colors to 256 when saving it as a GIF file. Someone then took this GIF file and perhaps added text or cropped the photo, and further compressed it to a JPG file which then discarded more color information. Do this a few times, and you now understand the condition of many JPG's available for download through the newsgroups on the USENET.


Uses of the File Formats ------------------------

If you are scanning a picture for the purposes of a screen image, save it originally as a TIF file. If you are using a high end graphics program such as Photoshop, the native format will also work well. Do all your editing while the file is in the TIF format. Do the cropping, fix the colors, add the text. Each time you save your work, keep the TIF format. Once the image is finished and no more editing is needed, then decide on the final format. If the image is destined for being transferred over a modem, then the TIF file will be a bad choice for the final format because of its size. Your native program format such as .PSD for Photoshop will also be too large, and probably not readable by someone who doesn't have that program. So it comes down generally to either a GIF or a JPG.

If the image you are working on is limited in color or less than 256 colors, then you may want to use the GIF format. The GIF format will reduce the file size and make it usable for modem transfers, and can be edited and resaved without losing any quality. The GIF format is good for color graphs or line art which use limited color. If you wanted to make a header for your Web Page which had a solid blue box with white lettering inside, the GIF format would be a good choice since there are only two different colors being used. If the picture has more than 256 colors, then consider using the JPG format. An image of a persons face contains thousands of colors just in the skin tones alone, without considering the rest of the picture. If you save the picture as a GIF, you will lose all the fine shades of color and reduce those thousands of colors to only 256. This may result in a grainy or 'pixelated' look where the colors don't change smoothly from shade to hade.

You can illustrate this by creating a color bar in your graphics program which displays a graduated change from red to blue. In changing gradually from red to blue, thousands of shades of the red and blue will be used to make the change appear smooth. If you save this as a GIF file and reduce the colors to 256, you will see that the gradual change is not so gradual anymore, but has abrupt changes in color along the wheel. Common examples of areas of gradual change in pictures would be skies, sunsets, human skin tones, etc.... These pictures are best displayed in the JPG format.

You may need to experiment with the compression setting when saving a JPG to discover how much compression the image can tolerate. However, many good graphics packages allow you to choose a setting of 'maximum' or 'high quality' which generally produce excellent results. Also, consider your purpose for the image. If you know your target user will be displaying your picture on a monitor set to 256 colors, then it will be a waste to save anything more than 8 bit, and the GIF format will work just fine. One theory is to make the image look good using the 256 colors rather than risking what your 24 bit image will look like on a lesser bit monitor setting.

Once you save the file as a GIF or JPG, it will not be the same as your original TIF file. If you plan on re-editing the file later, keep the TIF file on your hard drive. If it does become necessary to edit a JPG file, try to use a higher end graphics program such as Photoshop to re-save the file. Good programs will allow you to set your quality setting to 'maximum', which will result in almost no loss of visible content. Stay away from any program which does not allow you to set the compression quality. The goal here is to achieve a balance between quality and file size, so you need control to reach the goal.

Enough of the 3 letter words. If you keep your TIF's, JPG's and GIF's in order, you will enhance your enjoyment in the wonderful world of computer graphics.


  • [DIR] Ronnie A, and Addie, too...
  • [DIR] Come see us in Sylmar!
  • [DIR] Inspirational Poetry
  • [DIR] Remembances Poetry
  • [DIR] Know USS Vallejo! through Poetry
  • [DIR] The Four Noble Truths
  • [DIR] The Moving Feasts
  • [DIR] A Song of the Shepherd
  • [DIR] Project Plowshare
  • [DIR] Ronnie's Resume
  • [DIR] Passages - the site menu
  • [DIR] The Front Porch - a graphical entryway
  • [DIR] The Garage - hop in, and let's travel to Ronnie's Favorite Places

  • ...This page was generated in one short evaluation period by HTMLed
  • Drop us a line!

    I hope you're fine ....

    Did you know what day it was? Just look in the calendar
    Explore our cyberhome at your liesure...     We bid you welcome!

    Nuclear site is owned by
    Ronnie A.

    Want to join Nuclear?
    [Skip Prev] [Prev] [Next] [Skip Next] [Random] [Next 5] [List Sites]
    How long is it to the Millenium?