Common Graphic File Formats for Images

From Free Knowledge Base- The DUCK Project: information for everyone
Revision as of 02:32, 11 February 2008 by Admin (Talk | contribs)

Jump to: navigation, search

Common Formats

BMP: Windows Bitmap

The three most common bitmaps, 1, 8 and 24 bit bitmaps. The number of bits in a bitmap represents the possible number of colors the given bitmap can contain. This means that a 1-bit bitmap can have two possible colors, which are always black and white. The 1 bit bitmap is also known as a monochrome bitmap.

The 8-bit bitmap can contain up to 256 colors (2^8 = 256) and the 24-bit bitmap can have up to 16.7 millions colors (2^24 = 16.7 million). The value X-bit defines the size of each pixel in a bitmap. So an 8-bit bitmap with a width of 100 and a height of 200 takes up 100*200*8 bit = 160 KBits = 20 KB.

GIF: CompuServe Graphics Interchange Format

GIF streams start with a screen descriptor that defines image resolution and color depth, followed by an optional global color map (palette). GIF uses LZW (Lempel-Ziv-Welch) lossless compression. GIF images are paletted with up to 256 colors. Each color is a 24 bit RGB value. Animated GIFs. A GIF file can contain more than one image.

Internet service provider CompuServe introduced GIF (Graphics Interchange Format) in 1987 as a format to transmit images with up to 256 different colors. In 1989 a revised specification was published that added some features to the format.

It was only later that people found out that LZW, the compression algorithm used to store the image data within GIF, was patented by Unisys. When GIF finally became popular, Unisys started charging license fees for creating software that reads or writes GIF files, even website owners who used GIF images on their site. This eventually triggered the development of PNG, the Portable Network Graphics image file format, in 1995, meant as a replacement for GIF. On June 20, 2003, the LZW patent expires in the US. In 2004 (supposedly July 7th) the patent will expire in the other countries where Unisys holds it.

JPG / JPEG: Joint Photographic Experts Group Format (JFIF)

This file format was originally called the "Joint Photographic Experts Group File Interchange Format", or short, JFIF. A JPEG bitstream is a sequence of data chunks, each chunk starts with a marker value. For compression JPG mostly utilizes Baseline DCT / Huffman, providing lossy compression. The image is a continous tone photo with five or more bits per channel.

PNG: Portable Network Graphics Format

Introduced in 1995 as a free alternative to Unisys's greedy patent claim on the GIF format, PNG was slow to be adopted by companies like Microsoft so the format did not catch on right away. Today PNG is supported by all the major web browsers. PNG builds on the idea of transparency in GIF images and allows the control of the degree of transparency, known as opacity. PNG uses deflate compression and is sometimes preprocessed in a way that helps it compress better. PNG does not support animation like GIF does.

A PNG stream consists of a number of data chunks. Each chunk stores its type and size, then follows the chunk data, then a CRC-32 checksum value. PNG image types are Grayscale, with 1, 2, 4, 8 or 16 bits per sample, RGB truecolor, with 24 or 48 bits per pixel, Paletted, with 1, 2, 4 or 8 bits per pixel. Like GIF, the PNG format supports transparency. Howevever, unlike GIF, PNG can do it on truecolor images. Both grayscale and truecolor can store an alpha channel which contains transparency information.

TIF / TIFF: Tagged Image File Format

This graphics format is more complex than most, allowing for different types of compression and designed to be extensible. Most of the time a TIF uses lossless compression, however, it is possible to save a TIF using a lossy compression type, even a JPEG bitstream. A TIFF file may also be saved "uncompressed" making the file size large, like a bitmap. When compressed, the most common compression types use are: LZW Compression, bilevel fax/CCITT 3, Huffman Encoding, or Packbits.

TIFF, the Tagged Image File Format was designed by the companies Aldus and Microsoft in the 1980s to store pixel image data. Due to all of the variances in format and compression type, no known single image software is capable of reading all valid TIFF files, however, it is rare that you will encounter a TIF file of one of the more obscure formats.

 

What Format is Best For...

Scanning and Archiving Photographs or other True Color Proof Images

Use: TIF / TIFF -w- LZW Compression
recommended file extension: *.tif

Reason: Provides lossless compression so your images do not degrade by repeated saving and quality is not lost due to the type of compression. Because it is compressed, you save disk space over saving your proof images as bitmaps.

Photograph or Proof Image Copies for use on the Web

Use: JPG / JPEG
recommended file extension: *.jpg

Reason: Provides extremely high compression (recommended using a factor of 15% which is standard) with a type of compression that, although lossy, the trade-off is justified to aid in download times. JPEG's are great for sharing photos on the web, or creating truecolor images for your web site. It is also a good format to share images with people via email.

Remember not to continue to make edits to your JPEG image. Each time you re-save the JPEG image some quality is lost, enough to notice after just a few saves. Always keep a PROOF copy of your images in a full color format such as a TIFF. Use the JPEG as a final complete copy of the TIFF proof for use on the web.

Cartoons, Drawings, or Clipart 256 Colors or Less for Archiving or Use on the Web

Use: PNG
recommended file extension: *.png

Reason: The other alternative is to use a GIF, however, PNG typically provides 5% - 25% better compression over GIF. Using a format such as JPEG is very wrong because JPEG is for true color images and thus will convert your paletted image to truecolor, which is inefficient and unnecessary. You will achieve better compression without quality loss using PNG over JPEG on images that are 256 color or less.

Animated Graphics for the Web

Use: GIF
recommended file extension: *.gif

Reason: The only widely supported graphic type for doing web animation within an image is GIF.

Grayscale Photographs or Web Images

Use: GIF
recommended file extension: *.gif

Reason:

CMYK Images For Professional Printing

Use:
recommended file extension: *.

Reason:

Raster and Mask Images for Game Animation

Use: Bitmap
recommended file extension: *.bmp

Reason: Most widely supported for programming environments. Note that other formats may be better for specific environments, however, in general, the bitmap is the most widely used and support graphic type when working in programming environments.