Which file format should you use – JPEG, GIF or PNG?

The graphical world can be complicated with lots of confusing terminologies. There’s a myriad of file formats and it’s hard to know when you need to use them. When considering which file formats to use online you need to consider the file types abilities and balance quality with file size.

In today’s tip, we are going to focus on JPEG, GIF and PNGs which are all raster graphic files, composed of pixels, as opposed to vector graphics, which are composed of paths. The main differences between JPEG, GIF and PNG files are colour range, transparency, ability to animate, compression and file size.

JPG/JPEG (Joint Photographic Experts Group) have the following characteristics:

  • millions of colours
  • doesn’t allow transparency
  • can’t be animated
  • lossy compression, which means that data is discarded during compression
  • small file size, based on level of compression

GIF (Graphic Interchange Format) have the following characteristics:

  • 256 colours
  • transparency of a single colour
  • can be animated
  • lossless compression
  • potentially small file size – due to limited colour palette

To make matters even more confusing, PNG is split into two types. There’s PNG-8, which share a lot of characteristics with GIFs; and PNG-24, which share characteristics with JPEGs.

PNG-8 (Portable Network Graphics) have the following characteristics:

  • 256 colours
  • better transparency but still limited
  • can’t be animated
  • lossless compression
  • potentially slightly smaller file sizes than GIFs

PNG-24 (Portable Network Graphics) have the following characteristics:

  • millions of colours
  • transparency capable of fading
  • can’t be animated
  • lossless compression
  • range of file sizes

JPEGs are great for photos and complex images. The lossy compression means that you can reduce the size of the file without removing much visible quality. The visual quality is rivalled by PNG-24, but PNG-24 as a lossless compression can’t compete on file size.

GIFs are really useful for simple animations, which the other formats covered here don’t offer. They are also good for small flat icons, but in most cases, we would use a PNG-8, as the file size is generally slightly smaller.

PNG-8 are limited in their range of colour, but work well for simple icons. PNG-24, with their huge colour range, are great for more complex icons, logos, simple graphics, and graphics that require transparency.

Still confused? We’d be happy to help – drop us a line on hello@energycreative.co.uk

Which file format should you use