Digital Image Formats

Image file formats are standardized means of organizing and storing digital images. Image files are composed of digital data in one of these formats that can be rasterized for use on a computer display or printer. An image file format may store data in uncompressed, compressed, or vector formats. Once rasterized, an image becomes a grid of pixels, each of which has a number of bits to designate its color equal to the color depth of the device displaying it.

Image file sizes

The size of raster image files is positively correlated with the resolution and images size (number of pixels) and the color depth (bits per pixel). Images can be compressed in various ways, however. A compression algorithm stores either an exact representation or an approximation of the original image in a smaller number of bytes that can be expanded back to its uncompressed form with a corresponding decompression algorithm. Images with the same number of pixels and color depth can have very different compressed file size. Considering exactly the same compression, number of pixels, and color depth for two images, different graphical complexity of the original images may also result in very different file sizes after compression due to the nature of compression algorithms. With some compression formats, images that are less complex may result in smaller compressed file sizes. This characteristic sometimes results in a smaller file size for some lossless formats than lossy formats. For example, graphically simple images (i.e. images with large continuous regions like line art or animation sequences) may be losslessly compressed into a GIF or PNG format and result in a smaller file size than a lossy JPEG format.

Vector images, unlike raster images, can be any dimension independent of file size. File size increases only with the addition of more vectors.

For example, a 640 * 480 pixel image with 24-bit color would occupy almost a megabyte of space:

640 * 480 * 24 = 7,372,800 bits  = 921,600 bytes = 900 KiB

BMP – Bitmap. This was probably the first type of digital image format that I can remember. Every picture on a computer seemed those days to be a BMP. In Windows XP the Paint program saves its images automatically in BMP. However, in Windows Vista and later images are now saved to JPEG. BMP is the basis platform for many other file types.

JPG / JPEG – (Joint Photographic Experts Group) Jpeg format is used for color photographs, or any pictures with many blends or gradients. It is not good with sharp edges and tends to blur them a bit unless stored at high quality. This format became popular with the invention of the digital camera. Most, if not all, digital cameras download photos to your computer as a Jpeg file. Obviously the digital camera manufacturers see the value in high quality images that ultimately take up less space.

GIF – (Graphics Interchange Format) Gif format is best used for text, line drawings, screenshots, cartoons, and animations. Gif is limited to a total number of 256 colors or less, so Gif images are relatively small. It is commonly used for fast loading web pages. It also makes a great banner or logo for your web-page. Animated pictures can also be saved in GIF format as a sequence of static images. For example, a flashing banner would be saved as a Gif file.

moving-circles

PNG – (Portable Networks Graphic) This lossless formats is one of the best image formats. It was not always compatible with all web browsers or image software, but nowadays it is the best image format to use for website. I use .png for logos and screenshots. One of its most astonishing abilities is being able to compress images losslessly (without loss of pixels), although the final compressed size varies between image editors.

TIFF – (Tagged Image File Format) This file format has not been updated since 1992 and is now owned by Adobe. It can store an image and data (tags) in the one file. TIFF can be compressed, but it is rather its ability to store image data in a lossless format that makes a TIFF file a useful image archive, because unlike standard JPEG files, a TIFF file using lossless compression (or none) may be edited and re-saved without losing image quality. This file is commonly used for scanning, faxing, word processing, and so on. It is no longer a common file format to use with your digital photos, as jpeg is great quality and takes up less space.

 

Image file compression

There are two types of image file compression algorithms: lossless and lossy.

Lossless compression algorithms reduce file size while preserving a perfect copy of the original uncompressed image. Lossless compression generally, but not always, results in larger files than lossy compression. Lossless compression should be used to avoid accumulating stages of re-compression when editing images.

Lossy compression algorithms preserve a representation of the original uncompressed image that may appear to be a perfect copy, but it is not a perfect copy. Often lossy compression is able to achieve smaller file sizes than lossless compression. Most lossy compression algorithms allow for variable compression that trades image quality for file size.

–Thanks to wikipedia