Why are there so many different image formats (JPG, PNG, etc.) on the web?


Why are there so many different image formats (JPG, PNG, etc.) on the web?

In: Technology

Short answer: for historical reasons

Long answer:
That’s not necessarily a bad thing since the widespread ones each have their own purpose.

Because no single format is the best for everything, There are differences in filesize, quality, method of image creation, color space, transparency, animation, compression techniques, compatibility, etc.

For a company logo, it would be a terrible idea to use jpeg, a vector format like svg would be far better.

For a photograph, you might use png or jpeg, depending on your quality vs size tradeoff.

For a loading animation, you might use gif.

I thought about hammering this out my self and then realized i could just do this:

There aren’t really that many – I’d hazard that excluding animated gifs, the vast majority of images on the web are either jpg or png.

But originally there was gif. Then along came jpg, which was better for digital photos, which were becoming more common. Then png, which supported transparency.

New formats don’t always replace old formats.

They all store the data in different ways which makes them all suited to specific tasks. For example, PNGs are excellent at storing images with transparency or large blocks of the same color (such as a cartoon or graph), JPGs are good at photographs which don’t require transparency, GIFs allow storing multiple images (often used for simple animations), and SVGs are for vector art.

Many of the others are proprietary or made with a specific use case in mind, so if you’re overwhelmed by the options the 4 types I mentioned will work in 99.9% of cases