In most cases you’ll use JPG for compressing images for your website, but there are other formats that are useful for certain applications. Here are a few formats and bit about each of them.
GIF is one of the more common image file formats in existence. Gif is a lossless compression process that supports only 256 colours and is more suited for simple images with few colours and small text; it also supports animation, and transparency.
JPG is the other common image file format, and the one websites use more often then not. It’s a lossy compression technique that is suited best for photo’s and complex graphics. The process discards information the eye cannot detect and supports 16 million colours. JPG however is not ideal for line drawings, lettering, or other simple images due to the fact there is less for the process to discard.
PNG’s are an emerging format online, hampered by browser support from becoming dominant despite it’s advantages to the other formats. It was developed as an alternative to the GIF format due to patent licensing issues. Some of the benefits PNG brings along are improved compression over GIF, more transparency options such as alpha channels (gives control of fades into the background), more colours comparable to JPG, and doesn’t degrade when re-saving.
SVG is another up and coming image format designed with vector graphics in mind. The image can be scaled indefinitely without loss of quality or pixelation, while other formats don’t fare so well. The features include transformations, clipping paths, alpha masks, filter effects, and template objects. Support for this format is however limited because of the need for a plugin to view the format in Internet Explorer.