Why are there so many different image formats on the Web?
It certainly is true that there are lots of different image formats on the web — Just at How Stuff Works, we use 6 different image formats: • GIF files • JPEG files • Animated GIF files • MPEG files • Shockwave files • NxView files The two most common by far are GIF and JPEG files. Both of these formats encode static (as opposed to animated) bitmap images . In a bitmap image, the image file has to define the exact color of every pixel in the image. For example, imagine a typical bitmap on the web that is 400 by 400 pixels. To define this image, you would need 24 bits per pixel for 160,000 pixels, or 480,000 bytes. That would be a huge image file, so both the GIF and JPG formats compress the image in different ways. In a GIF image, the number of colors is reduced to 256 and then “runs” of same-color pixels are encoded in a color+numberOfPixels format. For example, if there are 100 pixels on a line with the color 41, the image file stores the color (41) and the length of the run (100).