Do you know the difference between JPEG, GIF, PNG and other graphic formats? When should I use one format or another, or which one is best for saving photos? Below you will find answers to all these questions.
Lossy/Lossless Data Compression Algorithms
First of all, you need to understand the difference between lossy and lossless data compression algorithms. Lossless compression is a method of image compression that preserves its quality no matter how many times the file has been compressed and restored.
When using lossy compression, the image quality will decrease every time the file is compressed/decompressed. One of the undoubted advantages of this method is the possibility of a greater degree of compression. Lossless compression is more suitable for storing and editing photos, however, if you need to send an image by e-mail or publish it on the Web, it is better to use the second method.
A file format containing raw information coming directly from the sensor of semi-professional and professional cameras. These files are not processed by the camera’s processor and contain all the captured information in a “raw” form. These files can be larger than 25 MB. RAW files are great for editing, but because of their large size, they are not very convenient to store.
This is perhaps the most common graphic format. It is usually used to publish photos and images with text on the Internet. JPEG is a TrueColor format, which means it can store images with a color depth of 24 bits/pixel. This format can display more than 16 million colors.
JPEG has earned its popularity due to its flexible data compression capability. If necessary, the image can be saved with high quality. When using a lossy compression algorithm, there is a loss of image quality with each save of the file. Shown below are high, medium, and low quality JPEG images.
JPEG with high quality (100). Size 113 KB
JPEG with medium quality (50). Size 59 KB
JPEG low quality (20). Size 27 KB
The GIF (Graphics Interchange Format) format does not please with color depth (8 bits). It can store lossless compressed images up to 256 colors. One of the features of GIF is animation support.
ON THIS TOPIC:
This format was developed as a replacement for GIF. PNG stands for Portable Network Graphics. Unlike GIF, PNG has support for transparency gradations due to an additional alpha channel. Transparency is usually indicated by a checkerboard background, as seen in the image below.
Outwardly, PNG files practically do not differ from JPG images. PNG compresses lossless data. If transparency is important to you, it is better to choose this particular format.
This abbreviation stands for Tagged Image File Format. This is a high quality format used for storing images with a high color depth. TIFF files can be stored either compressed or decompressed. The great advantage of the format is the support of almost any compression algorithm.
An image in TIFF will not lose quality after each save of the file. But, unfortunately, it is precisely because of this that TIFF files weigh many times more than JPG and GIF.
The BMP (bitmap) format is one of the first graphic formats and is currently not very popular. BMP stores images with color depth up to 64 bits. This format supports transparency, but is not readable by some Microsoft applications. In other words, BMP files are best converted to other formats.
So what format should you use?
PNG is the best choice. It’s great for large images. If you need a high compression ratio, for example, to send a photo by e-mail, it is better to use JPEG. The TIFF format is quite complicated to work with and is practically not supported in browsers.
Below is a comparative table of characteristics of various formats.