Common Graphic File Formats for Images

From Free Knowledge Base- The DUCK Project: information for everyone
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.

A bitmap graphic may be referred to as a raster graphic. When viewed at 100%, each dot corresponds to an individual pixel on a display. A file with the .bmp extension is an uncompressed bitmap. Other raster graphic types, known as compressed bitmaps, include JPEG, GIF, and PNG. A bitmap is not a vector graphic. If a bitmap image is enlarged it will always look blocky because each dot will take up more than one pixel.

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. JPEG is a universal format meaning files can be opened and viewed in almost all image viewing applications. JPEG has existed for a long time and is a widely adopted format.

Baseline JPEG compression is the most common and is nearly synonymous with the use of the term JPEG. 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 continuous tone photo with five or more bits per channel. When decoded, the image appears from top to bottom like a windowshade rolling down. Compression is variable and governed by a number of parameters with typical settings providing from 10:1 to 20:1 reductions in file size.

The JPEG image format is ideal for producing highly compressed, true color images for the web. Web designers attempt to achieve small file sizes for the images used in web design to accommodate visitors with limited bandwidth (such as dialup and DSL users.) The small file size doesn't come without a price. Image quality is lost when saving as a JPEG (.jpg) and the higher the compression level selected, the more image quality is lost. Furthermore, each time the JPEG image is reopened and resaved, even more image quality is lost. Because of this JPEG is not suited for images that will be frequently modified, since detail is lost each time the image is saved.

JPEG files cannot have transparent backgrounds. The JPEG format is limited to 8-bits for color data, yielding 16.7 million colors. Although the human eye is not capable of discerning depths beyond this limitation, some modern digital cameras use 10-bit and higher color capture.

Note that although Baseline JPEG lossy compression is what is widely used there are other more obscure implementations including a lossless JPEG (JPEG lossless coding mode). It should also be noted that when using baseline JPEG compression, setting the quality to 100% in software when saving an image still results in image quality loss. It is not implied that such a setting would switch to a lossless coding mode.

PNG: Portable Network Graphics Format

Portable Network Graphics (PNG) was designed as a replacement for the GIF format in order to avoid infringement of Unisys' patent on the LZW compression technique. PNG offers better compression and more features than GIF, animation being the only significant exception. PNG is more suitable than GIF in instances where true-color imaging and alpha transparency are required.

PNG was slow to be adopted by companies like Microsoft so the format did not catch on right away. All modern web browsers generally support PNG. Older versions of Internet Explorer do not support all features of PNG. Versions 6 and earlier do not support alpha channel transparency without using Microsoft-specific HTML extensions. Gamma correction of PNG images was not supported before version 8, and the display of these images in earlier versions may have the wrong tint.

PNG tends to be a more efficient format, however, there are occasions where a PNG file can be larger than a GIF file because PNG is capable of storing more color depth and transparency information than GIF. For identical 8-bit (or lower) image data, PNG files are typically smaller than the equivalent GIFs, due to the more efficient compression techniques used in PNG encoding.

PNG is standardized, whereas complete support for the GIF format is complicated chiefly by the complex canvas structure it allows, though this is what enables the compact animation features. 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.

Copies of Photographs or other Proof Images 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: PNG or GIF
recommended file extension: *.png, *.gif

Reason: Typically PNG provides better compression, however, there are some examples where GIF results in the same or slightly smaller file size on gray scale images.

CMYK Images For Professional Printing

Use: TIFF
recommended file extension: *.tif

Reason: Remember that RGB is for a video monitor display while CMYK is for print with ink (see RGB versus CMYK). The TIFF image format supports multiple layers as well as RGB and CMYK color spaces, and even allows an image to contain spot-color channels.

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.

 

Other Formats

WMF: Windows Metafile

May contain a vector or bitmap image. This format can also combine elements of both. Windows Metafiles generally are used to store line-art, illustrations and content created in drawing or presentation applications. Due to the vector capabilities, the WMF format may contain executable code. WMF is the native vector format for Microsoft Office applications such as Word, PowerPoint, and Publisher.

WMF is a 16-bit format. There is a 32-bit updated version called Enhanced Metafile (EMF). There are known exploits for the WMF format since it utilizes the Windows graphics layer GDI to render vector images.

Many Graphic File Formats

Including proprietary types, there are hundreds of image file types. Some of the formats that are most often used for purposes including web pages, email, digital photography, and desktop publishing are discussed on this page.

 

 

KEY WORDS: BMP GIF JPG JPEG PNG TIF TIFF WMF PDF EPS PSD CSD