Common file types and their pros and cons

Like everything else, images have to be stored somewhere on a computer to be useable. Naturally, over time a number of different methods have been developed to store an image, leading to many different file formats. Each format had a particular usage in mind, and as a result each format has its strengths and weaknesses. To help give you a better understanding of what different formats are capable of and when to use them, here's a non-technical overview of the more popular formats.

Raster Image Formats

JPEG

This format uses a fancy algorithm that takes advantage of the limitations of the human eye. Instead of preserving every detail, it selectively pays attention to aspects the viewer will notice. Unfortunately, this results in corruptions in the image called "artifacts". Artifacts are more likely to occur and be noticeable around areas where the color shifts dramatically, such as around text.

A small note about the name: while the correct name is JPEG (pronounced Jay-Peg), the usual file extension (the letters after the period in a file name) is JPG. This is a hold-over from older computers that limited extensions to three letters. The name itself is an acronym of the format's creators, the Joint Photographic Experts Group.

Pros

JPEGs are extremely well adapted to storing photographs or other detailed work in small files. In fact, most digital cameras default to this format for this very reason. One particularly nice perk of this format is that they can store metadata (additional information about the picture) in their files without confusing software.

Cons

Since the image's data is selectively kept, it is not stored exactly. This can be problematic for programs that require images to have strictly defined values. The biggest drawback however is that artifacts can make text in an image unreadable, blurry or garbled.


Graphics Interchange Format (GIF)

GIFs use a palette to store the image's information. Once the image has been converted to this palette, it's compressed using a popular algorithm.

Pros

By using a small palette and the compression technique, GIF files are typically pretty small and thus very fast to send online. Other perks of this file type are their ability to use a color as a transparent mask and their ability to be animated.

Cons

Despite their advantages, GIFs are falling out of favor as time moves on. Other formats are more powerful and the rampant abuse of the animation features has led to them being disdained by professionals and users alike. Additionally, there were some ethical issues over software patents that made them unpalatable and controversial, as they use a patented method for their compression.



Bitmap (BMP)

The default image format for Microsoft Windows, this format is largely obsolete these days. It's a simple dump of the pixel values for the image. This is very accurate when it comes to storing an image, but it comes at the cost of huge files.

Pros

These files faithfully store every pixel of an image, and thus lose none of the detail. Also, since they are nothing more than a dump of the image's data, they can be saved to a file faster than anything else.

Cons

Even though some compression schemes are available to this format, the file will still be much bigger than any other file type. Additionally, some other formats (namely PNG) are just as faithful to the original image's information, but use far less space to store it. Thanks to their huge size, BMPs should never be used on the internet: they require far more bandwidth than they're worth.



Protable Network Graphic (PNG)

This format has become quite popular online as it mixes the strengths of some of the above formats. In fact, most of the graphics on this site are PNGs!

Pros

PNGs are potent hybrids of ideas. They store every pixel in an image like a Bitmap, can store metadata like JPEGs, and use fancy compression techniques and transparency like a GIF. There are some big differences however. Compared to GIFs, PNGs have better compression methods and these are free of the ethical baggage of the software patent fights. Also, PNG's transparency features can use a range of values, making them better at blending into the background.

Cons

PNGs' biggest strength is also its biggest weakness: they handle images with large blocks of color well, but intricate images like photographs cause them to falter and produce files larger than JPEGs.

Vector Image Formats

SWF

This is the format of Flash objects. While these can be fancy interactive programs, they can also be used to display and store vector images.

Pros

Flash was designed to make animations, so naturally these files can also be animated. Flash's ability to use symbols can also greatly cut down file sizes, though that's something of a moot point with vector graphics as those tend to make very small files anyway.

Cons

Probably the biggest downside of this format is that it requires a special plug-in to view the image. Very few programs can save to this format, and the one that does the majority of it is the expensive Flash authoring tool itself.



SVG

Lastly, this up and coming format is a text file that describes a vector graphic.

Pros

Patent-free and open to anyone, it's already preferred by many to the SWF format. Most major browsers already support it without a plug-in.

Cons

It's still a very young format however, so it has yet to become anywhere near as popular as the other formats listed on this page. As such, support for it is badly lacking.